On Mon, May 27, 2013 at 2:21 PM, Alexander Schaal <lis...@ruby-forum.com>wrote:
> Update 1:> I am using ruby 1.9.3p194 (2012-04-20) [i386-mingw32].>> Update 2:> With> result = system('...')> I can see if the exit code is zero or not EVEN if the process terminates> with seg fault / core dump.>
Hmm, works for me in case of core:
$ gcc -Wall -ansi -o core x.c
$ ./core
sizeof( a ) = 32
sizeof( pa ) = 4
sizeof( ppa ) = 4
sizeof( b ) = 11
sizeof( c ) = 32
sizeof( d ) = 24
Segmentation fault
$ echo $?
139
$ irb
Ruby version 1.9.3
irb(main):001:0> system("./core")
sizeof( a ) = 32
sizeof( pa ) = 4
sizeof( ppa ) = 4
sizeof( b ) = 11
sizeof( c ) = 32
sizeof( d ) = 24
=> false
irb(main):002:0> $?
=> #<Process::Status: pid 3824 SIGSEGV (signal 11)>
irb(main):003:0> puts $?
pid 3824 SIGSEGV (signal 11)
=> nil
irb(main):004:0> $?.exitstatus
=> nil
irb(main):006:0> RUBY_PATCHLEVEL
=> 392
$ ruby --version
ruby 1.9.3p392 (2013-02-22) [i386-cygwin]
And also for non core:
irb(main):001:0> system "test.exe"
=> false
irb(main):002:0> $?
=> #<Process::Status: pid 7996 exit 1>
irb(main):003:0> $?.exitstatus
=> 1
This is most likely an issue of your Windows version of Ruby. On Linux it
works the same as shown above.
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/