Visit Mozilla.org

nsIProcess

From MDC

The nsIProcess interface represents an executable process.

Contents

nsIProcess is defined in /xpcom/threads/nsIProcess.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 9.5.0).

Inherits from: nsISupports

Implemented by: @mozilla.org/process/util;1. To create an instance, use:

var cookieMonster = Components.classes["@mozilla.org/process/util;1"]
                    .createInstance(Components.interfaces.nsIProcess);

[edit] Method overview

void init(in nsIFile executable);
void initWithPid(in unsigned long pid);
void kill();
unsigned long run(in boolean blocking, [array, size_is(count)] in string args, in unsigned long count);

[edit] Attributes

Attribute Type Description
exitValue long The value returned by the process upon exit.
location nsIFile The location of the executable file on disk.
pid unsigned long The process ID of the process.
processName string The name of the process.
processSignature unsigned long The process signature.

[edit] Methods

[edit] init()

Initializes the nsIProcess with the specified executable file. Once initialized, you can start the process executing by calling run().

void init( in nsIFile executable );

[edit] Parameters
executable
The executable file to be represented by the nsIProcess object.

[edit] initWithPid()

Initializes the nsIProcess to represent an existing process, given that process's ID.

void initWithPid( in unsigned long pid );

[edit] Parameters
pid
The process ID to begin to represent.

[edit] kill()

Immediately terminates the process represented by the nsIProcess object.

void kill();

[edit] Parameters

None.

[edit] run()

Starts executing the process.

 unsigned long run(
   in boolean blocking,
   [array, size_is(count)] in string args,
   in unsigned long count
 );
[edit] Parameters
blocking
If true, the run() method will block until the process terminates; if false, the method returns immediately.
args
An array of count arguments to be passed to the executable on its command line.
count
The number of arguments in the args array.
[edit] Return value

The process ID (pid) of the newly spawned process.