xpcom/threads/nsIProcess.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/threads/nsIProcess.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,99 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +
    1.10 +interface nsIFile;
    1.11 +interface nsIObserver;
    1.12 +
    1.13 +[scriptable, uuid(609610de-9954-4a63-8a7c-346350a86403)]
    1.14 +interface nsIProcess : nsISupports
    1.15 +{
    1.16 +  /**
    1.17 +   * Initialises the process with an executable to be run. Call the run method
    1.18 +   * to run the executable.
    1.19 +   * @param executable The executable to run.
    1.20 +   */
    1.21 +  void init(in nsIFile executable);
    1.22 +
    1.23 +  /**
    1.24 +   * Kills the running process. After exiting the process will either have
    1.25 +   * been killed or a failure will have been returned.
    1.26 +   */
    1.27 +  void kill();
    1.28 +
    1.29 +  /**
    1.30 +   * Executes the file this object was initialized with
    1.31 +   * @param blocking   Whether to wait until the process terminates before
    1.32 +                       returning or not.
    1.33 +   * @param args       An array of arguments to pass to the process in the
    1.34 +   *                   native character set.
    1.35 +   * @param count      The length of the args array.
    1.36 +   */
    1.37 +  void run(in boolean blocking, [array, size_is(count)] in string args,
    1.38 +           in unsigned long count);
    1.39 +
    1.40 +  /**
    1.41 +   * Executes the file this object was initialized with optionally calling
    1.42 +   * an observer after the process has finished running.
    1.43 +   * @param args       An array of arguments to pass to the process in the
    1.44 +   *                   native character set.
    1.45 +   * @param count      The length of the args array.
    1.46 +   * @param observer   An observer to notify when the process has completed. It
    1.47 +   *                   will receive this process instance as the subject and
    1.48 +   *                   "process-finished" or "process-failed" as the topic. The
    1.49 +   *                   observer will be notified on the main thread.
    1.50 +   * @param holdWeak   Whether to use a weak reference to hold the observer.
    1.51 +   */
    1.52 +  void runAsync([array, size_is(count)] in string args, in unsigned long count,
    1.53 +                [optional] in nsIObserver observer, [optional] in boolean holdWeak);
    1.54 +
    1.55 +  /**
    1.56 +   * Executes the file this object was initialized with
    1.57 +   * @param blocking   Whether to wait until the process terminates before
    1.58 +                       returning or not.
    1.59 +   * @param args       An array of arguments to pass to the process in UTF-16
    1.60 +   * @param count      The length of the args array.
    1.61 +   */
    1.62 +  void runw(in boolean blocking, [array, size_is(count)] in wstring args,
    1.63 +	    in unsigned long count);
    1.64 +
    1.65 +  /**
    1.66 +   * Executes the file this object was initialized with optionally calling
    1.67 +   * an observer after the process has finished running.
    1.68 +   * @param args       An array of arguments to pass to the process in UTF-16
    1.69 +   * @param count      The length of the args array.
    1.70 +   * @param observer   An observer to notify when the process has completed. It
    1.71 +   *                   will receive this process instance as the subject and
    1.72 +   *                   "process-finished" or "process-failed" as the topic. The
    1.73 +   *                   observer will be notified on the main thread.
    1.74 +   * @param holdWeak   Whether to use a weak reference to hold the observer.
    1.75 +   */
    1.76 +  void runwAsync([array, size_is(count)] in wstring args,
    1.77 +		 in unsigned long count,
    1.78 +		 [optional] in nsIObserver observer, [optional] in boolean holdWeak);
    1.79 +
    1.80 +  /**
    1.81 +   * The process identifier of the currently running process. This will only
    1.82 +   * be available after the process has started and may not be available on
    1.83 +   * some platforms.
    1.84 +   */
    1.85 +  readonly attribute unsigned long pid;
    1.86 +
    1.87 +  /**
    1.88 +   * The exit value of the process. This is only valid after the process has
    1.89 +   * exited.
    1.90 +   */
    1.91 +  readonly attribute long exitValue;
    1.92 +
    1.93 +  /**
    1.94 +   * Returns whether the process is currently running or not.
    1.95 +   */
    1.96 +  readonly attribute boolean isRunning;
    1.97 +};
    1.98 +
    1.99 +%{C++
   1.100 +
   1.101 +#define NS_PROCESS_CONTRACTID "@mozilla.org/process/util;1"
   1.102 +%}

mercurial