It's amazing how much time a mere three or so lines of code
When I was working on my nsIProcess patch for
jslib I couldn't immediately see how to get return
does not support call by reference. The
process id (PID) of the newly spawned process is supposed to
be returned in this manner.
Yesterday I discovered the
XPConnect FAQ and specifically section 3 "How do I
use interface methods with 'out' parameters from
- create a new object,
- supply the object as the required 'out' argument
- then, after the call, retrieve the return value from
the object via a newly created property named 'value'.
(If the parameter is 'inout' you supply an object with the
'value' property already set.)
I immediately tried implementing this for getting the PID
back from the newly spawned process and... it didn't work.
:-/ It appears most of the "extra" functionality of the
nsIProcess interface isn't actually implemented.
I also couldn't discover much more information on its
implementation status in the few web references to
nsIProcess I could find. (Oddly enough my reference
to nsIProcess from a couple of days ago appears as
result #9 in Google's search results--which gives some
indication of the amount of documentation on the interface!)
I got thinking about what it would take to implement the
functionality and after much digging through source code
macro indirection I found what appears to be the underlying
process identifier structure '_MDProcess'. While this
structure contains some sort of process id under Unix &
Windows (well a handle at least) it doesn't for all
The nsIProcess interface isn't consistently
implemented for both Windows/Unix and Mac anyway so I guess
it wouldn't matter if PID functionality wasn't initially
implemented for both either.
After all that I submitted a Mozilla
bug about the unimplemented state of nsIProcess
so we'll see what happens. In some far off world I might
even do something about it...
Interestingly I also tried out the kill() functionality but
that didn't seem to work under Linux either, despite the
fact it *does* appear to be implemented.
Cross-referenced web-based source code
repositories like lxr are very useful.