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 | code?: typeof ERROR_COMMAND_NOT_FOUND | typeof ERROR_NON_ZERO_EXIT | typeof ERROR_SIGNAL_EXIT;
|
22 | output?: string;
|
23 | signal?: string;
|
24 | exitCode?: number;
|
25 | }
|
26 | export interface SubprocessOptions extends SpawnOptions {
|
27 | }
|
28 | export interface SubprocessBashifyOptions {
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | maskArgv0?: boolean;
|
39 | |
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | maskArgv1?: boolean;
|
49 | |
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | shiftArgv0?: boolean;
|
58 | }
|
59 | export declare class Subprocess {
|
60 | name: string;
|
61 | args: readonly string[];
|
62 | protected readonly path?: string;
|
63 | protected _options: SpawnOptions;
|
64 | constructor(name: string, args: readonly string[], options?: SubprocessOptions);
|
65 | get options(): Readonly<SpawnOptions>;
|
66 | output(): Promise<string>;
|
67 | combinedOutput(): Promise<string>;
|
68 | run(): Promise<void> & {
|
69 | p: ChildProcess;
|
70 | };
|
71 | spawn(): ChildProcess;
|
72 | bashify({ maskArgv0, maskArgv1, shiftArgv0 }?: SubprocessBashifyOptions): string;
|
73 | bashifyArg(arg: string): string;
|
74 | maskArg(arg: string): string;
|
75 | }
|
76 | export declare function spawn(command: string, args?: readonly string[], options?: SpawnOptions): ChildProcess;
|
77 | export declare function fork(modulePath: string, args?: readonly string[], options?: ForkOptions & Pick<SpawnOptions, 'stdio'>): ChildProcess;
|
78 | export interface WhichOptions {
|
79 | PATH?: string;
|
80 | PATHEXT?: string;
|
81 | }
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 | export declare function which(program: string, { PATH, PATHEXT }?: WhichOptions): Promise<string>;
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 | export declare function findExecutables(program: string, { PATH, PATHEXT }?: WhichOptions): Promise<string[]>;
|