NsIProcess: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:
process.open(arguments, arguments.length)
process.open(arguments, arguments.length)


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

Revision as of 17:05, 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 be 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