Sha256: a2ee137636d20322490890cc094a9c70f316fe5f1351efef385a87c0ab4cfec3

Contents?: true

Size: 946 Bytes

Versions: 6

Compression:

Stored size: 946 Bytes

Contents

---
layout: page
title: Polyphony::Process
parent: API Reference
permalink: /api-reference/polyphony-process/
---
# Polyphony::Process

The `Polyphony::Process` module is used to watch child processes.

## Class Methods

### #watch(cmd = nil, { block })

Starts a child process, blocking until the child process terminates. If `#watch`
is interrupted before the child process terminates, the child process is sent a
`TERM` signal, and awaited. After 5 seconds, if the child has still not
terminated, it will be sent a `KILL` signal and awaited. This method is normally
used in conjunction with `#supervise` in order to supervise child processes.

If `cmd` is given, the child process is started using `Kernel#spawn` running a
shell command. If a block is given, the child process is started using
[`Polyphony#fork`](../polyphony/#fork-block---pid).

```ruby
Polyphony::Process.watch('echo "Hello World"; sleep 1')
supervise(restart: :always)
```

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
polyphony-0.41 docs/api-reference/polyphony-process.md
polyphony-0.40 docs/api-reference/polyphony-process.md
polyphony-0.39 docs/api-reference/polyphony-process.md
polyphony-0.38 docs/api-reference/polyphony-process.md
polyphony-0.36 docs/api-reference/polyphony-process.md
polyphony-0.34 docs/api-reference/polyphony-process.md