lib/polyphony/adapters/process.rb
# Watches a forked or spawned process, waiting for it to terminate. If
# `cmd` is given it is spawned, otherwise the process is forked with the
# given block.
# 
# If the operation is interrupted for any reason, the spawned or forked
# process is killed.
#
# @param cmd [String, nil] command to spawn
# @param &block [Proc] block to fork
# @return [void]
Watches a forked or spawned process, waiting for it to terminate. If
`cmd` is given it is spawned, otherwise the process is forked with the
given block.

If the operation is interrupted for any reason, the spawned or forked
process is killed.
Watches a forked or spawned process waiting for it to terminate . If ` cmd ` is given it is spawned otherwise the process is forked with the given block . If the operation is interrupted for any reason the spawned or forked process is killed .
def watch(cmd = nil, &block)
        terminated = nil
        pid = cmd ? Kernel.spawn(cmd) : Polyphony.fork(&block)
        Polyphony.backend_waitpid(pid)
        terminated = true
      ensure
        kill_process(pid) unless terminated || pid.nil?
      end
def watch ( cmd = nil , & block ) terminated = nil pid = cmd ? Kernel . spawn ( cmd ) : Polyphony . fork ( & block ) Polyphony . backend_waitpid ( pid ) terminated = true ensure kill_process ( pid ) unless terminated || pid . nil? end
Watches a forked or spawned process, waiting for it to terminate.
Watches a forked or spawned process waiting for it to terminate .
None
void
cmd
command to spawn
command to spawn
block
<not_specific>
&block
<not_specific>
block to fork
block to fork