1 |
|
2 | import { ChildProcess, ForkOptions, SpawnOptions } from 'child_process';
|
3 | export declare const ERROR_COMMAND_NOT_FOUND = "ERR_SUBPROCESS_COMMAND_NOT_FOUND";
|
4 | export declare const ERROR_NON_ZERO_EXIT = "ERR_SUBPROCESS_NON_ZERO_EXIT";
|
5 | export declare const ERROR_SIGNAL_EXIT = "ERR_SUBPROCESS_SIGNAL_EXIT";
|
6 | export declare const TILDE_PATH_REGEX: RegExp;
|
7 | export declare function expandTildePath(p: string): string;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export declare function convertPATH(path?: string): string;
|
19 | export declare class SubprocessError extends Error {
|
20 | readonly name = "SubprocessError";
|
21 | message: string;
|
22 | stack: string;
|
23 | code?: typeof ERROR_COMMAND_NOT_FOUND | typeof ERROR_NON_ZERO_EXIT | typeof ERROR_SIGNAL_EXIT;
|
24 | error?: Error;
|
25 | output?: string;
|
26 | signal?: string;
|
27 | exitCode?: number;
|
28 | constructor(message: string);
|
29 | }
|
30 | export interface SubprocessOptions extends SpawnOptions {
|
31 | }
|
32 | export interface SubprocessBashifyOptions {
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | maskArgv0?: boolean;
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 | maskArgv1?: boolean;
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | shiftArgv0?: boolean;
|
62 | }
|
63 | export declare class Subprocess {
|
64 | name: string;
|
65 | args: readonly string[];
|
66 | protected readonly path?: string;
|
67 | protected _options: SpawnOptions;
|
68 | constructor(name: string, args: readonly string[], options?: SubprocessOptions);
|
69 | get options(): Readonly<SpawnOptions>;
|
70 | output(): Promise<string>;
|
71 | combinedOutput(): Promise<string>;
|
72 | run(): Promise<void> & {
|
73 | p: ChildProcess;
|
74 | };
|
75 | spawn(): ChildProcess;
|
76 | bashify({ maskArgv0, maskArgv1, shiftArgv0 }?: SubprocessBashifyOptions): string;
|
77 | bashifyArg(arg: string): string;
|
78 | maskArg(arg: string): string;
|
79 | }
|
80 | export declare function spawn(command: string, args?: readonly string[], options?: SpawnOptions): ChildProcess;
|
81 | export declare function fork(modulePath: string, args?: readonly string[], options?: ForkOptions & Pick<SpawnOptions, 'stdio'>): ChildProcess;
|
82 | export interface WhichOptions {
|
83 | PATH?: string;
|
84 | PATHEXT?: string;
|
85 | }
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | export declare function which(program: string, { PATH, PATHEXT }?: WhichOptions): Promise<string>;
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | export declare function findExecutables(program: string, { PATH, PATHEXT }?: WhichOptions): Promise<string[]>;
|