NsIProcess: Difference between revisions
Jump to navigation
Jump to search
m (→Sample Usage) |
Jamesboston (talk | contribs) No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= | =nsIProcess2 API Proposal= | ||
Project page: [http://zenit.senecac.on.ca/wiki/index.php/User:Jamesboston/nsIProcess Fixing nsIProcess] | |||
===JS API=== | |||
=== | |||
<code> | <code> | ||
<pre> | <pre> | ||
// | 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"); | |||
</pre> | </pre> | ||
</code> | </code> | ||
= | === Underlying XPCOM interfaces === | ||
<code> | |||
<pre> | |||
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); | |||
}; | |||
</pre> | |||
</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);
};