Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Would you consider taking this change? #122

Closed
wants to merge 1 commit into from
Closed

Would you consider taking this change? #122

wants to merge 1 commit into from

Conversation

rcook
Copy link

@rcook rcook commented Apr 10, 2013

Update to ExternalRuntime to use Kernel.spawn version of IO.popen to merge stderr and stdout and enable timeouts

This fix changes exec_runtime to take an options hash that allows the caller to specify a :timeout option. This will impose a timeout on an exec or eval call. The with_timeout helper method imposes this timeout by running the external command on a separate thread if a non-zero and non-nil. Using the Kernel.spawn version of the IO.popen method means that only a single child process needs to be spawned to handle merging of stderr and stdout: this allows exec_runtime to properly clean up the child process without leaving any orphans hanging around. The exec and eval methods on Module and Runtime have been updated to take the new options hash. Note that this change does not implement timeouts for other runtimes. This will follow as I get to them.

REFERENCES

http://unethicalblogger.com/2011/11/12/popen-can-suck-it.html

…merge stderr and stdout and enable timeouts

This fix changes exec_runtime to take an options hash that allows the caller to specify a :timeout option. This will impose a timeout on an exec or eval call. The with_timeout helper method imposes this timeout by running the external command on a separate thread if a non-zero and non-nil. Using the Kernel.spawn version of the IO.popen method means that only a single child process needs to be spawned to handle merging of stderr and stdout: this allows exec_runtime to properly clean up the child process without leaving any orphans hanging around. The exec and eval methods on Module and Runtime have been updated to take the new options hash. Note that this change does not implement timeouts for other runtimes. This will follow as I get to them.

REFERENCES

http://unethicalblogger.com/2011/11/12/popen-can-suck-it.html
@rcook rcook closed this Apr 10, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant