xpcom/threads/nsIProcess.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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"
     7 interface nsIFile;
     8 interface nsIObserver;
    10 [scriptable, uuid(609610de-9954-4a63-8a7c-346350a86403)]
    11 interface nsIProcess : nsISupports
    12 {
    13   /**
    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.
    17    */
    18   void init(in nsIFile executable);
    20   /**
    21    * Kills the running process. After exiting the process will either have
    22    * been killed or a failure will have been returned.
    23    */
    24   void kill();
    26   /**
    27    * Executes the file this object was initialized with
    28    * @param blocking   Whether to wait until the process terminates before
    29                        returning or not.
    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.
    33    */
    34   void run(in boolean blocking, [array, size_is(count)] in string args,
    35            in unsigned long count);
    37   /**
    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.
    48    */
    49   void runAsync([array, size_is(count)] in string args, in unsigned long count,
    50                 [optional] in nsIObserver observer, [optional] in boolean holdWeak);
    52   /**
    53    * Executes the file this object was initialized with
    54    * @param blocking   Whether to wait until the process terminates before
    55                        returning or not.
    56    * @param args       An array of arguments to pass to the process in UTF-16
    57    * @param count      The length of the args array.
    58    */
    59   void runw(in boolean blocking, [array, size_is(count)] in wstring args,
    60 	    in unsigned long count);
    62   /**
    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.
    72    */
    73   void runwAsync([array, size_is(count)] in wstring args,
    74 		 in unsigned long count,
    75 		 [optional] in nsIObserver observer, [optional] in boolean holdWeak);
    77   /**
    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
    80    * some platforms.
    81    */
    82   readonly attribute unsigned long pid;
    84   /**
    85    * The exit value of the process. This is only valid after the process has
    86    * exited.
    87    */
    88   readonly attribute long exitValue;
    90   /**
    91    * Returns whether the process is currently running or not.
    92    */
    93   readonly attribute boolean isRunning;
    94 };
    96 %{C++
    98 #define NS_PROCESS_CONTRACTID "@mozilla.org/process/util;1"
    99 %}

mercurial