Héctor Rivas Gándara wrote:
Hi,I need to execute an external program from a XPCOM component. I'm actually using the nspr librar, with the function PR_CreateProcess(), but I have two questions:Is there any nspr function or XPCOM service to search the executable in the $PATH by name?
You can use execvp (spawnvp on Windows) instead.
How can I wait until the program exists and kill it after a timeout?
For that you could use system(...). However, to be able to kill it after a timeout, you probably need to use the calls above (the alternative is to call system from a separate thread), register a signal handler to detect the process exiting or use wait, and apparently also have a thread that wakes up after the time-out, checks if the process exited, and kills it if it hasn't.
-- Saudos Keymon _______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom
Not exactly pseudocode, but hope that helps.
smime.p7s
Description: S/MIME Cryptographic Signature
