Hi Tim,
I started using Servolux on a small internal project and so far I'm really
pleased with it. What I'm doing is very simple: I have to manage a few
scripts and start them with the right command-line arguments (does the
acronym CLA mean anything to anyone? I've never seen it used but it would
make my life so much easier). I use Servolux::Child objects for that.
I'm glad you are finding Servolux useful!
Is there a way, internally, to know whether one of the processes handled by
the Child object has been kill-9'd by, say, an outside human hand? I don't
really know enough about the popen stuff and process communication to
figure that out.
The Servolux::Child class provides several methods to determine the status of the child process.
* alive? -- This method returns +true+ if the child process is still alive. So if someone kills the process (kill -9) then this method will return +false+. If this method returns +nil+, the the child process was never started.
There are several methods that map directly to the ruby Process::Status class and can be used to find out exactly how and why the child process exited. All of these methods can be called on your Servolux::Child instance:
* coredump?
* exited?
* signaled?
* stopped?
* success?
* exitstatus
* stopsig
* termsig
You can read the documentation for these methods here => Class: Process::Status (Ruby 1.9.3)
In your case the methods to look at are "signaled?" and "termsig". If "termsig" returns 9, then someone used kill -9 to stop the process.
Hope all this helps!
Blessings,
TwP
···
On Jan 10, 2012, at 1:05 PM, Aldric Giacomoni wrote: