Question.
Situation:
I want to start a process, then loop, checking for its status, so that I
can "know" when it finishes, and not block the Tk.mainloop.
Anybody know how to determine runningness of a process in ruby?
Thanks!
···
--
Posted via http://www.ruby-forum.com/.
I could possibly add something like this to Rev, although you would only be
able to receive the events when you're running a Rev event loop, and MRI may
swallow SIGCHLD.
···
On Tue, Sep 1, 2009 at 3:31 PM, Roger Pack <rogerpack2005@gmail.com> wrote:
Question.
Situation:
I want to start a process, then loop, checking for its status, so that I
can "know" when it finishes, and not block the Tk.mainloop.
Anybody know how to determine runningness of a process in ruby?
Thanks!
--
Posted via http://www.ruby-forum.com/\.
--
Tony Arcieri
Medioh/Nagravision
Roger Pack wrote:
Question.
Situation:
I want to start a process, then loop, checking for its status, so that I
can "know" when it finishes, and not block the Tk.mainloop.
Anybody know how to determine runningness of a process in ruby?
Thanks!
Don't the Process.wait family of methods do what you want? Maybe:
Process.waitpid(pid, Process::WNOHANG)
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
Joel VanderWerf wrote:
Roger Pack wrote:
Question.
Situation:
I want to start a process, then loop, checking for its status, so that I
can "know" when it finishes, and not block the Tk.mainloop.
Anybody know how to determine runningness of a process in ruby?
Thanks!
Don't the Process.wait family of methods do what you want? Maybe:
Process.waitpid(pid, Process::WNOHANG)
Interesting. I think that that's what Python's Process#poll uses
internally. Unfortunately it appears that both it and Process::WNOHANG
and Linux only (I'm on doze). Hmm.
-r
···
--
Posted via http://www.ruby-forum.com/\.
Roger Pack wrote:
Joel VanderWerf wrote:
Roger Pack wrote:
Question.
Situation:
I want to start a process, then loop, checking for its status, so that I
can "know" when it finishes, and not block the Tk.mainloop.
Anybody know how to determine runningness of a process in ruby?
Thanks!
Don't the Process.wait family of methods do what you want? Maybe:
Process.waitpid(pid, Process::WNOHANG)
Interesting. I think that that's what Python's Process#poll uses internally. Unfortunately it appears that both it and Process::WNOHANG and Linux only (I'm on doze). Hmm.
-r
The win32-process gem claims to handle some of that functionality...
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
The win32-process gem claims to handle some of that functionality...
It probably does give some hints as to how one could accomplish this
[not waiting for INFINITY, for example].
http://allgems.ruby-forum.com/gems/doc/win32-process/0.6.0
I did figure out a way that appears to work in windows, for any
followers...
http://betterlogic.com/roger/?p=1900
Works for me 
-r
···
--
Posted via http://www.ruby-forum.com/\.
Roger Pack wrote:
The win32-process gem claims to handle some of that functionality...
It probably does give some hints as to how one could accomplish this [not waiting for INFINITY, for example].
http://allgems.ruby-forum.com/gems/doc/win32-process/0.6.0
I did figure out a way that appears to work in windows, for any followers...
http://betterlogic.com/roger/?p=1900
Works for me 
-r
If you're going to fire up a thread (as in Timeout), you could also do something like this (maybe a bit more efficient):
done = false
Thread.new {Process.wait(a.pid); done = true}
loop do
# ...
if done
# ...
end
end
(I hope that doesn't fail on windows, but didn't test it...)
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407