Weird behavior with exec /backticks

I have the following shell script that I call with backticks

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.