Skip to content

Instantly share code, notes, and snippets.

@vvs
Created December 7, 2009 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvs/250785 to your computer and use it in GitHub Desktop.
Save vvs/250785 to your computer and use it in GitHub Desktop.
if RUBY_PLATFORM == 'java'
require 'jruby'
JRuby.runtime.instance_config.run_ruby_in_process = false
end
0.upto(4) do |n|
IO.popen("ruby -e 'exit(#{n})'") do |ioh|
ioh.each { |line| print line }
end
puts "From popen: #{$?.exitstatus}"
`ruby -e 'exit(#{n})'`
puts "From backquote: #{$?.exitstatus}"
system("ruby -e 'exit(#{n})'")
puts "From system: #{$?.exitstatus}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment