1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
10 [scriptable
, uuid(609610de
-9954-4a63
-8a7c
-346350a86403
)]
11 interface nsIProcess
: nsISupports
14 * Initialises the process with an executable to be run. Call the run method
15 * to run the executable.
16 * @param executable The executable to run.
18 void init
(in nsIFile executable
);
21 * Kills the running process. After exiting the process will either have
22 * been killed or a failure will have been returned.
27 * Executes the file this object was initialized with
28 * @param blocking Whether to wait until the process terminates before
30 * @param args An array of arguments to pass to the process in the
31 * native character set.
32 * @param count The length of the args array.
34 void run
(in boolean blocking
, [array
, size_is(count
)] in string args
,
35 in unsigned long count
);
38 * Executes the file this object was initialized with optionally calling
39 * an observer after the process has finished running.
40 * @param args An array of arguments to pass to the process in the
41 * native character set.
42 * @param count The length of the args array.
43 * @param observer An observer to notify when the process has completed. It
44 * will receive this process instance as the subject and
45 * "process-finished" or "process-failed" as the topic. The
46 * observer will be notified on the main thread.
47 * @param holdWeak Whether to use a weak reference to hold the observer.
49 void runAsync
([array
, size_is(count
)] in string args
, in unsigned long count
,
50 [optional] in nsIObserver observer
, [optional] in boolean holdWeak
);
53 * Executes the file this object was initialized with
54 * @param blocking Whether to wait until the process terminates before
56 * @param args An array of arguments to pass to the process in UTF-16
57 * @param count The length of the args array.
59 void runw
(in boolean blocking
, [array
, size_is(count
)] in wstring args
,
60 in unsigned long count
);
63 * Executes the file this object was initialized with optionally calling
64 * an observer after the process has finished running.
65 * @param args An array of arguments to pass to the process in UTF-16
66 * @param count The length of the args array.
67 * @param observer An observer to notify when the process has completed. It
68 * will receive this process instance as the subject and
69 * "process-finished" or "process-failed" as the topic. The
70 * observer will be notified on the main thread.
71 * @param holdWeak Whether to use a weak reference to hold the observer.
73 void runwAsync
([array
, size_is(count
)] in wstring args
,
74 in unsigned long count
,
75 [optional] in nsIObserver observer
, [optional] in boolean holdWeak
);
78 * The process identifier of the currently running process. This will only
79 * be available after the process has started and may not be available on
82 readonly attribute
unsigned long pid
;
85 * The exit value of the process. This is only valid after the process has
88 readonly attribute
long exitValue
;
91 * Returns whether the process is currently running or not.
93 readonly attribute
boolean isRunning
;
98 #define NS_PROCESS_CONTRACTID
"@mozilla.org/process/util;1"