R
rj-cole
Hi,
I'm trying to write a function that will spawn a process, and after a
timeout kill the process if it hasn't terminated yet.
def spawn(inputString, cmd, outputFileName)
inp = IO.popen("(" + cmd + ") > #{outputFileName} ", "w")
inp << inputString
inp.close_write
end
What is the best way to change this so that (i) it works, and (ii) it
gives the process some number of seconds to complete, and if it hasn't
completed then it kills it and returns an error?
This code only needs to run under linux.
regards,
Richard.
I'm trying to write a function that will spawn a process, and after a
timeout kill the process if it hasn't terminated yet.
def spawn(inputString, cmd, outputFileName)
inp = IO.popen("(" + cmd + ") > #{outputFileName} ", "w")
inp << inputString
inp.close_write
end
What is the best way to change this so that (i) it works, and (ii) it
gives the process some number of seconds to complete, and if it hasn't
completed then it kills it and returns an error?
This code only needs to run under linux.
regards,
Richard.