Sha256: f12c07eebd458174845ced05769b851e305002479165925199ea0e71c19be148

Contents?: true

Size: 955 Bytes

Versions: 87

Compression:

Stored size: 955 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
spin { Polyphony::Process.watch('echo "Hello World"; sleep 1') }
supervise(restart: :always)
```

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
polyphony-0.99 docs/api-reference/polyphony-process.md
polyphony-0.98 docs/api-reference/polyphony-process.md
polyphony-0.97 docs/api-reference/polyphony-process.md
polyphony-0.96 docs/api-reference/polyphony-process.md
polyphony-0.95 docs/api-reference/polyphony-process.md
polyphony-0.94 docs/api-reference/polyphony-process.md
polyphony-0.93 docs/api-reference/polyphony-process.md
polyphony-0.92 docs/api-reference/polyphony-process.md
polyphony-0.91 docs/api-reference/polyphony-process.md
polyphony-0.90 docs/api-reference/polyphony-process.md
polyphony-0.89 docs/api-reference/polyphony-process.md
polyphony-0.87 docs/api-reference/polyphony-process.md
polyphony-0.86 docs/api-reference/polyphony-process.md
polyphony-0.85 docs/api-reference/polyphony-process.md
polyphony-0.84.1 docs/api-reference/polyphony-process.md
polyphony-0.84 docs/api-reference/polyphony-process.md
polyphony-0.83 docs/api-reference/polyphony-process.md
polyphony-0.82 docs/api-reference/polyphony-process.md
polyphony-0.81.1 docs/api-reference/polyphony-process.md
polyphony-0.81 docs/api-reference/polyphony-process.md