Created
December 6, 2010 16:55
-
-
Save phiggins/730563 to your computer and use it in GitHub Desktop.
DeferrableChildProcess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
# Code adapted from EM's tests: | |
# https://github.com/eventmachine/eventmachine/blob/master/tests/test_processes.rb#L43 | |
ls = "" | |
EM.run { | |
d = EM::DeferrableChildProcess.open( "ruby -v" ) | |
d.callback {|data_from_child| | |
ls = data_from_child | |
EM.stop | |
} | |
} | |
puts ls | |
# linux | |
# $ ruby -Ilib test_processes.rb | |
# ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] | |
# winxp | |
# >ruby -Ilib test_processes.rb | |
# terminate called after throwing an instance of 'std::runtime_error' | |
# what(): socketpair is currently unavailable on this platform | |
# | |
# This application has requested the Runtime to terminate it in an unusual way. | |
# Please contact the application's support team for more information. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment