Abort a system call

Hello everyone,

I'm new to Ruby, a friend talked about it some days ago with great pleasure, so I was interested in giving it a shot. I was quite happy when I saw that the Perl scripts I had only required little change to still be working in Ruby. They are simple scripts though, mainly system call wrappers. But here is exactly where the problem comes. When I do in Perl sth like

system "$decoder $bitstreamPath $yuvOutputPath";

I can interrupt the execution with ctrl-c. The Ruby script does what it is expected to, but I cannot interrupt the program with ctrl-c anymore, and have to wait until the execution is finished. I tried several alternatives:

system "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
syscall "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
exec "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
system $decoder, $bitstreamPath, $yuvOutputPath

but none is interuptable... is there something fundamental I am missing in the way Ruby handles system calls?

Oh, I am running Cygwin on 2000. In case its important.

Bart.

Masschelein Bart wrote:

ยทยทยท

Hello everyone,

I'm new to Ruby, a friend talked about it some days ago with great
pleasure, so I was interested in giving it a shot. I was quite happy
when I saw that the Perl scripts I had only required little change to
still be working in Ruby. They are simple scripts though, mainly
system call wrappers. But here is exactly where the problem comes.
When I do in Perl sth like

system "$decoder $bitstreamPath $yuvOutputPath";

I can interrupt the execution with ctrl-c. The Ruby script does what
it is expected to, but I cannot interrupt the program with ctrl-c
anymore, and have to wait until the execution is finished. I tried
several alternatives:

system "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
syscall "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
exec "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
system $decoder, $bitstreamPath, $yuvOutputPath

but none is interuptable... is there something fundamental I am
missing in the way Ruby handles system calls?

Oh, I am running Cygwin on 2000. In case its important.

Bart.

Masschelein Bart wrote:

Hello everyone,

I'm new to Ruby, a friend talked about it some days ago with great
pleasure, so I was interested in giving it a shot. I was quite happy
when I saw that the Perl scripts I had only required little change to
still be working in Ruby. They are simple scripts though, mainly
system call wrappers. But here is exactly where the problem comes.
When I do in Perl sth like

system "$decoder $bitstreamPath $yuvOutputPath";

I can interrupt the execution with ctrl-c. The Ruby script does what
it is expected to, but I cannot interrupt the program with ctrl-c
anymore, and have to wait until the execution is finished. I tried
several alternatives:

system "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
syscall "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
exec "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
system $decoder, $bitstreamPath, $yuvOutputPath

but none is interuptable... is there something fundamental I am
missing in the way Ruby handles system calls?

Oh, I am running Cygwin on 2000. In case its important.

Bart.

Without trying out: maybe you have to explicitely set a signal handler for
SIGINT that then terminates the child process. Could be that perl does it
automatically for you.

Kind regards

    robert