Created
January 4, 2011 20:09
-
-
Save luislavena/765328 to your computer and use it in GitHub Desktop.
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
C:\Users\Luis>irb | |
irb(main):001:0> require 'rbconfig' | |
=> true | |
irb(main):002:0> NULL = RbConfig::CONFIG['host_os'] =~ /mingw|mswin/ ? 'NUL' : '/dev/null' | |
=> "NUL" | |
irb(main):003:0> success = system("git --version >#{NULL} 2>&1") | |
=> true | |
irb(main):004:0> success | |
=> true | |
irb(main):005:0> $? | |
=> #<Process::Status: pid 1040 exit 0> | |
irb(main):006:0> $?.success? | |
=> true | |
irb(main):007:0> success = system("git-foo --version >#{NULL} 2>&1") | |
=> false | |
irb(main):008:0> success | |
=> false | |
irb(main):009:0> $? | |
=> #<Process::Status: pid 3588 exit 1> | |
irb(main):010:0> $?.success? | |
=> false | |
irb(main):011:0> RUBY_DESCRIPTION | |
=> "ruby 1.9.2p136 (2010-12-25) [i386-mingw32]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment