bbc/process-helper

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

Homepage:

Size: 12

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Process Helper

Provides a wrapper around external processes

It collects standard-out and standard-error, allowing:

License

This is licensed under the Apache 2.0 License

Example usage
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
Caveats

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

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.