Abort a system call

  • Thread starter Masschelein Bart
  • Start date
M

Masschelein Bart

------_=_NextPart_001_01C58093.02B674D2
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello everyone,
=20
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=20
=20
system "$decoder $bitstreamPath $yuvOutputPath";
=20
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:
=20
system "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
syscall "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
exec "#{$decoder} #{$bitstreamPath} #{$yuvOutputPath}";
system $decoder, $bitstreamPath, $yuvOutputPath
=20
but none is interuptable... is there something fundamental I am missing =
in the way Ruby handles system calls?
=20
Oh, I am running Cygwin on 2000. In case its important.
=20
Bart.

------_=_NextPart_001_01C58093.02B674D2--
 
R

Robert Klemme

Masschelein said:
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.
 
R

Robert Klemme

Masschelein said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top