UNPKG

4.34 kBTypeScriptView Raw
1import { Observable } from 'rxjs';
2/**
3 * Finds the actual executable and parameters to run on Windows. This method
4 * mimics the POSIX behavior of being able to run scripts as executables by
5 * replacing the passed-in executable with the script runner, for PowerShell,
6 * CMD, and node scripts.
7 *
8 * This method also does the work of running down PATH, which spawn on Windows
9 * also doesn't do, unlike on POSIX.
10 *
11 * @param {string} exe The executable to run
12 * @param {Array<string>} args The arguments to run
13 *
14 * @return {Object} The cmd and args to run
15 * @property {string} cmd The command to pass to spawn
16 * @property {Array<string>} args The arguments to pass to spawn
17 */
18export declare function findActualExecutable(exe: string, args: Array<string>): {
19 cmd: string;
20 args: Array<string>;
21};
22/**
23 * Spawns a process but detached from the current process. The process is put
24 * into its own Process Group that can be killed by unsubscribing from the
25 * return Observable.
26 *
27 * @param {string} exe The executable to run
28 * @param {Array<string>} params The parameters to pass to the child
29 * @param {Object} opts Options to pass to spawn.
30 *
31 * @return {Observable<string>} Returns an Observable that when subscribed
32 * to, will create a detached process. The
33 * process output will be streamed to this
34 * Observable, and if unsubscribed from, the
35 * process will be terminated early. If the
36 * process terminates with a non-zero value,
37 * the Observable will terminate with onError.
38 */
39export declare function spawnDetached(exe: string, params: Array<string>, opts?: any): Observable<string>;
40/**
41 * Spawns a process attached as a child of the current process.
42 *
43 * @param {string} exe The executable to run
44 * @param {Array<string>} params The parameters to pass to the child
45 * @param {Object} opts Options to pass to spawn.
46 *
47 * @return {Observable<string>} Returns an Observable that when subscribed
48 * to, will create a child process. The
49 * process output will be streamed to this
50 * Observable, and if unsubscribed from, the
51 * process will be terminated early. If the
52 * process terminates with a non-zero value,
53 * the Observable will terminate with onError.
54 */
55export declare function spawn<T = string>(exe: string, params?: Array<string>, opts?: any): Observable<T>;
56/**
57 * Spawns a process but detached from the current process. The process is put
58 * into its own Process Group.
59 *
60 * @param {string} exe The executable to run
61 * @param {Array<string>} params The parameters to pass to the child
62 * @param {Object} opts Options to pass to spawn.
63 *
64 * @return {Promise<string>} Returns an Promise that represents a detached
65 * process. The value returned is the process
66 * output. If the process terminates with a
67 * non-zero value, the Promise will resolve with
68 * an Error.
69 */
70export declare function spawnDetachedPromise(exe: string, params: Array<string>, opts?: any): Promise<string>;
71/**
72 * Spawns a process as a child process.
73 *
74 * @param {string} exe The executable to run
75 * @param {Array<string>} params The parameters to pass to the child
76 * @param {Object} opts Options to pass to spawn.
77 *
78 * @return {Promise<string>} Returns an Promise that represents a child
79 * process. The value returned is the process
80 * output. If the process terminates with a
81 * non-zero value, the Promise will resolve with
82 * an Error.
83 */
84export declare function spawnPromise(exe: string, params: Array<string>, opts?: any): Promise<string>;