NsIProcess: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(An inauspicious start?)
 
No edit summary
Line 21: Line 21:
// alternatively it could opened with interprocess communication
// alternatively it could opened with interprocess communication
process.open(arguments, arguments.length, stdin, stdout, stderr)
process.open(arguments, arguments.length, stdin, stdout, stderr)
// stdin  
// stdin - callback
// stdout
// stdout - callback
// stderr
// stderr - callback


// check if the executable is still running
// check if the executable is still running

Revision as of 16:06, 21 September 2008

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