J
Joe Van Dyk
Why doesn't this work?
(#executable is a function that returns a string that contains a test
application that spits out some data)
def start
pid =3D fork=20
if pid.nil? # In child
log =3D File.open(executable + ".log", "w")
STDOUT.reopen(log)
STDERR.reopen(log)
exec executable # Start program
exit
else # In parent
@pid =3D pid # Record new process id
Process.detach @pid # If the process dies, let it die =20
monitor # Start monitoring the process' status
end
end
Well, it works for the most part. The log file gets created, but
nothing gets written to it. Am I not redirecting output correctly?
Thanks,
Joe
Thanks,
Joe
(#executable is a function that returns a string that contains a test
application that spits out some data)
def start
pid =3D fork=20
if pid.nil? # In child
log =3D File.open(executable + ".log", "w")
STDOUT.reopen(log)
STDERR.reopen(log)
exec executable # Start program
exit
else # In parent
@pid =3D pid # Record new process id
Process.detach @pid # If the process dies, let it die =20
monitor # Start monitoring the process' status
end
end
Well, it works for the most part. The log file gets created, but
nothing gets written to it. Am I not redirecting output correctly?
Thanks,
Joe
Thanks,
Joe