Class | BackgroundProcess |
In: |
lib/background_process/background_process.rb
|
Parent: | Object |
pid | [R] | |
stderr | [R] | |
stdin | [R] | |
stdout | [R] |
Initialize a BackgroundProcess task. Don‘t do this. Use BackgroundProcess.run or BackgroundProcess.run_pty instead
Run a command, connecting it‘s IO streams (stdin, sterr, stdout) via IO pipes, which are not tty IO streams.
Because of this, some programs (like ruby) will buffer their output and only make it available when it‘s explicitely flushed (with IO#flush or when the buffer gets full). This behavior can be overridden by setting the streams to sync, like this:
STDOUT.sync, STDERR.sync = true, true
If you can‘t control the program and have it explicitly flush its output when it should, or you can‘t tell the streams to run in sync mode, see PTYBackgroundProcess.run for a workaround.
Calls block each time a line is available in the specified output buffer(s) and returns the first non-false value By default, both stdout and stderr are monitored.
Args:
send a signal to the process. If the processes and running, do nothing. Valid signals are those in Signal.list. Default is "TERM"
waits for the process to finish. Freeze the process so it can rest in peace. You should call this on every background job you create to avoid a flood of zombie processes. (Processes won‘t go away until they are waited on)