NsIProcess

From MozillaWiki
Revision as of 04:33, 21 September 2008 by Jamesboston (talk | contribs) (An inauspicious start?)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 
// stdout
// stderr

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

// stop the process
process.close()

Reference

Project page: Fixing nsIProcess