NsIProcess

Revision as of 16:06, 21 September 2008 by Jamesboston (talk | contribs)

nsIProcess API Proposal

First draft API Proposal

Although code will be written in standard XPCOM, the first draft proposal only describes how the API will look from javascript.

Sample Usage

// first argument is the executable
var arguments = ["argument1", "argument2"];

// create nsIProcess
var process = Components.classes["@mozilla.org/process/util;1"]
                        .createInstance(Components.interfaces.nsIProcess);

// start the executable
process.open(arguments, arguments.length)

// alternatively it could opened with interprocess communication
process.open(arguments, arguments.length, stdin, stdout, stderr)
// stdin - callback
// stdout - callback
// stderr - callback

// check if the executable is still running
process.isRunning()

// stop the process
process.close()

Reference

Project page: Fixing nsIProcess