Name: process-helper
Owner: BBC
Description: Utility for managing sub processes.
Created: 2015-06-12 09:56:31.0
Updated: 2017-01-12 08:54:34.0
Pushed: 2016-11-23 09:27:21.0
Size: 12
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Provides a wrapper around external processes
It collects standard-out and standard-error, allowing:
This is licensed under the Apache 2.0 License
utable_args = ['echo', 'hello $USER, ruby passed me "$V"']
_for = /(hello .*)/
ess = ProcessHelper::ProcessHelper.new()
ess.start(executable_args, wait_for, 30, {'V' => 'v'})
This will start the process echo
and wait for it to have printed a line matching the regex to STDOUT.
For a longer running process that you want to interact with:
ess = ProcessHelper::ProcessHelper.new()
ess.start(['java', '-jar', 'some.jar'], /(Server Started)/)
teractions with the java process...
ess.kill
ess.wait_for_exit
There should be one ProcessHelper instance per external process. For example, the following will only kill the second process.
ess = ProcessHelper::ProcessHelper.new()
ess.start(['long_running_process', 'one'])
ess.start(['long_running_process', 'two'])
ess.kill