Weird behavior with exec /backticks

T

Tim Uckun

I have the following shell script that I call with backticks

http://gist.github.com/626072

What this script does it to execute the params passed but kill the
process if a timeout expires.

When I run this script from the shell everything works just fine.
Either the command finished before the timeout and the process exits
or the the timeout kicks in and kill the process.


but when I run it like this

output = `#{executable} '#{param1}' '#{param2}' 45

it acts differently. If the command finished before the timeout the
script does not exit. It waits the full timeout.

Can anybody explain this? That sub process should have been killed
right away and the script should have returned but my script hangs for
the full 45 seconds even if the command finishes in two seconds.
 

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

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top