NsIProcess: Difference between revisions
Jump to navigation
Jump to search
Jamesboston (talk | contribs) No edit summary |
Jamesboston (talk | contribs) No edit summary |
||
| Line 9: | Line 9: | ||
Components.utils.import("resource://gre/Process.jsm"); | Components.utils.import("resource://gre/Process.jsm"); | ||
function callback(evt) { | |||
// | // do stuff | ||
} | |||
/ | var p = new Process(["appdir/myapp", "someargs], | ||
p. | {cwd: "ProfD", charset: "utf8"}, | ||
callback); | |||
p.start(); | |||
// | // or without callback | ||
var p = new Process(["appdir/myapp", "someargs], | |||
/ | {cwd: "ProfD", charset: "utf8"}); | ||
p.start(); | |||
p. | |||
var ret = p.communicate("something"); | |||
p. | |||
</pre> | </pre> | ||
</code> | </code> | ||
Latest revision as of 17:29, 6 July 2009
nsIProcess2 API Proposal
Project page: Fixing nsIProcess
JS API
Components.utils.import("resource://gre/Process.jsm");
function callback(evt) {
// do stuff
}
var p = new Process(["appdir/myapp", "someargs],
{cwd: "ProfD", charset: "utf8"},
callback);
p.start();
// or without callback
var p = new Process(["appdir/myapp", "someargs],
{cwd: "ProfD", charset: "utf8"});
p.start();
var ret = p.communicate("something");
Underlying XPCOM interfaces
interface nsIProcess2 : public nsISupports
{
void init(in nsIFile program);
void inheritStdin();
void pipeStdin(in nsIPOSIXOutputStream);
void inheritStdout();
void fileStdout(in nsIFile);
void pipeStdout(in nsIPOSIXInputStream);
void inheritStderr();
void fileStderr(in nsIFile);
void pipeStderr(in nsIPOSIXInputStream);
readonly attribute unsigned long result;
readonly attribute unsigned long pid;
attribute nsIObserver listener;
void run([array, size_is(argv)] in wstring argv, in unsigned long argc);
};
interface nsIPOSIXOutputStream : public nsIOutputStream
{
/* the native POSIX file descriptor for this stream */
readonly attribute unsigned long fd;
};
interface nsIPOSIXInputStream : public nsIInputStream
{
/* the native POSIX file descriptor for this stream */
readonly attribute unsigned long fd;
};
interface nsIPipeManager : public nsISupports
{
nsIPOSIXInputStream createIncomingPipe();
nsIPOSIXOutputStream createOutgoingPipe();
nsIPOSIXInputStream readFile(in nsILocalFile file);
nsIPOSIXOutputStream writeFile(in nsILocalFile file);
};