KIlling a process inside a thread

I have

@child_thread = Thread.new do
  # puts "#{__FILE__} @ #{__LINE__} #{Time.now}"

  stdout = `#{the_command}`
  @child_thread_return_status = $?
end

and later

#child_thread.kill

This apearrs to kill the thread but not the command surrounded by the
back tick.

How do I kill the comand that is the backticked executable?

2010/9/1 Ralph S. [email protected]:

#child_thread.kill

This apearrs to kill the thread but not the command surrounded by the back tick.

How do I kill the comand that is the backticked executable?

You probably better use IO.popen then which gives you access to the
child’s PID. You’ll also need to handle the output returned from the
process differently depending on timeout or not timeout.

Kind regards

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs