1 | declare module 'child_process' {
|
2 | import { BaseEncodingOptions } from 'fs';
|
3 | import { EventEmitter, Abortable } from 'events';
|
4 | import * as net from 'net';
|
5 | import { Writable, Readable, Stream, Pipe } from 'stream';
|
6 |
|
7 | type Serializable = string | object | number | boolean | bigint;
|
8 | type SendHandle = net.Socket | net.Server;
|
9 |
|
10 | interface ChildProcess extends EventEmitter {
|
11 | stdin: Writable | null;
|
12 | stdout: Readable | null;
|
13 | stderr: Readable | null;
|
14 | readonly channel?: Pipe | null;
|
15 | readonly stdio: [
|
16 | Writable | null,
|
17 | Readable | null,
|
18 | Readable | null,
|
19 | Readable | Writable | null | undefined,
|
20 | Readable | Writable | null | undefined
|
21 | ];
|
22 | readonly killed: boolean;
|
23 | readonly pid?: number;
|
24 | readonly connected: boolean;
|
25 | readonly exitCode: number | null;
|
26 | readonly signalCode: NodeJS.Signals | null;
|
27 | readonly spawnargs: string[];
|
28 | readonly spawnfile: string;
|
29 | kill(signal?: NodeJS.Signals | number): boolean;
|
30 | send(message: Serializable, callback?: (error: Error | null) => void): boolean;
|
31 | send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
|
32 | send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
|
33 | disconnect(): void;
|
34 | unref(): void;
|
35 | ref(): void;
|
36 |
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | addListener(event: string, listener: (...args: any[]) => void): this;
|
48 | addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
49 | addListener(event: "disconnect", listener: () => void): this;
|
50 | addListener(event: "error", listener: (err: Error) => void): this;
|
51 | addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
52 | addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
53 | addListener(event: "spawn", listener: () => void): this;
|
54 |
|
55 | emit(event: string | symbol, ...args: any[]): boolean;
|
56 | emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
|
57 | emit(event: "disconnect"): boolean;
|
58 | emit(event: "error", err: Error): boolean;
|
59 | emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
|
60 | emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
|
61 | emit(event: "spawn", listener: () => void): boolean;
|
62 |
|
63 | on(event: string, listener: (...args: any[]) => void): this;
|
64 | on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
65 | on(event: "disconnect", listener: () => void): this;
|
66 | on(event: "error", listener: (err: Error) => void): this;
|
67 | on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
68 | on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
69 | on(event: "spawn", listener: () => void): this;
|
70 |
|
71 | once(event: string, listener: (...args: any[]) => void): this;
|
72 | once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
73 | once(event: "disconnect", listener: () => void): this;
|
74 | once(event: "error", listener: (err: Error) => void): this;
|
75 | once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
76 | once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
77 | once(event: "spawn", listener: () => void): this;
|
78 |
|
79 | prependListener(event: string, listener: (...args: any[]) => void): this;
|
80 | prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
81 | prependListener(event: "disconnect", listener: () => void): this;
|
82 | prependListener(event: "error", listener: (err: Error) => void): this;
|
83 | prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
84 | prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
85 | prependListener(event: "spawn", listener: () => void): this;
|
86 |
|
87 | prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
88 | prependOnceListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
89 | prependOnceListener(event: "disconnect", listener: () => void): this;
|
90 | prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
91 | prependOnceListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
92 | prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
|
93 | prependOnceListener(event: "spawn", listener: () => void): this;
|
94 | }
|
95 |
|
96 |
|
97 | interface ChildProcessWithoutNullStreams extends ChildProcess {
|
98 | stdin: Writable;
|
99 | stdout: Readable;
|
100 | stderr: Readable;
|
101 | readonly stdio: [
|
102 | Writable,
|
103 | Readable,
|
104 | Readable,
|
105 | Readable | Writable | null | undefined,
|
106 | Readable | Writable | null | undefined
|
107 | ];
|
108 | }
|
109 |
|
110 |
|
111 | interface ChildProcessByStdio<
|
112 | I extends null | Writable,
|
113 | O extends null | Readable,
|
114 | E extends null | Readable,
|
115 | > extends ChildProcess {
|
116 | stdin: I;
|
117 | stdout: O;
|
118 | stderr: E;
|
119 | readonly stdio: [
|
120 | I,
|
121 | O,
|
122 | E,
|
123 | Readable | Writable | null | undefined,
|
124 | Readable | Writable | null | undefined
|
125 | ];
|
126 | }
|
127 |
|
128 | interface MessageOptions {
|
129 | keepOpen?: boolean;
|
130 | }
|
131 |
|
132 | type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
133 |
|
134 | type StdioOptions = IOType | Array<(IOType | "ipc" | Stream | number | null | undefined)>;
|
135 |
|
136 | type SerializationType = 'json' | 'advanced';
|
137 |
|
138 | interface MessagingOptions extends Abortable {
|
139 | |
140 |
|
141 |
|
142 |
|
143 | serialization?: SerializationType;
|
144 |
|
145 | |
146 |
|
147 |
|
148 |
|
149 | killSignal?: NodeJS.Signals | number;
|
150 | }
|
151 |
|
152 | interface ProcessEnvOptions {
|
153 | uid?: number;
|
154 | gid?: number;
|
155 | cwd?: string;
|
156 | env?: NodeJS.ProcessEnv;
|
157 | }
|
158 |
|
159 | interface CommonOptions extends ProcessEnvOptions {
|
160 | |
161 |
|
162 |
|
163 | windowsHide?: boolean;
|
164 | |
165 |
|
166 |
|
167 | timeout?: number;
|
168 | }
|
169 |
|
170 | interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
171 | argv0?: string;
|
172 | stdio?: StdioOptions;
|
173 | shell?: boolean | string;
|
174 | windowsVerbatimArguments?: boolean;
|
175 | }
|
176 |
|
177 | interface SpawnOptions extends CommonSpawnOptions {
|
178 | detached?: boolean;
|
179 | }
|
180 |
|
181 | interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
182 | stdio?: StdioPipeNamed | StdioPipe[];
|
183 | }
|
184 |
|
185 | type StdioNull = 'inherit' | 'ignore' | Stream;
|
186 | type StdioPipeNamed = 'pipe' | 'overlapped';
|
187 | type StdioPipe = undefined | null | StdioPipeNamed;
|
188 |
|
189 | interface SpawnOptionsWithStdioTuple<
|
190 | Stdin extends StdioNull | StdioPipe,
|
191 | Stdout extends StdioNull | StdioPipe,
|
192 | Stderr extends StdioNull | StdioPipe,
|
193 | > extends SpawnOptions {
|
194 | stdio: [Stdin, Stdout, Stderr];
|
195 | }
|
196 |
|
197 |
|
198 | function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
199 |
|
200 | function spawn(
|
201 | command: string,
|
202 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
203 | ): ChildProcessByStdio<Writable, Readable, Readable>;
|
204 | function spawn(
|
205 | command: string,
|
206 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
207 | ): ChildProcessByStdio<Writable, Readable, null>;
|
208 | function spawn(
|
209 | command: string,
|
210 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
211 | ): ChildProcessByStdio<Writable, null, Readable>;
|
212 | function spawn(
|
213 | command: string,
|
214 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
215 | ): ChildProcessByStdio<null, Readable, Readable>;
|
216 | function spawn(
|
217 | command: string,
|
218 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
219 | ): ChildProcessByStdio<Writable, null, null>;
|
220 | function spawn(
|
221 | command: string,
|
222 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
223 | ): ChildProcessByStdio<null, Readable, null>;
|
224 | function spawn(
|
225 | command: string,
|
226 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
227 | ): ChildProcessByStdio<null, null, Readable>;
|
228 | function spawn(
|
229 | command: string,
|
230 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
231 | ): ChildProcessByStdio<null, null, null>;
|
232 |
|
233 | function spawn(command: string, options: SpawnOptions): ChildProcess;
|
234 |
|
235 |
|
236 | function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
237 |
|
238 | function spawn(
|
239 | command: string,
|
240 | args: ReadonlyArray<string>,
|
241 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
242 | ): ChildProcessByStdio<Writable, Readable, Readable>;
|
243 | function spawn(
|
244 | command: string,
|
245 | args: ReadonlyArray<string>,
|
246 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
247 | ): ChildProcessByStdio<Writable, Readable, null>;
|
248 | function spawn(
|
249 | command: string,
|
250 | args: ReadonlyArray<string>,
|
251 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
252 | ): ChildProcessByStdio<Writable, null, Readable>;
|
253 | function spawn(
|
254 | command: string,
|
255 | args: ReadonlyArray<string>,
|
256 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
257 | ): ChildProcessByStdio<null, Readable, Readable>;
|
258 | function spawn(
|
259 | command: string,
|
260 | args: ReadonlyArray<string>,
|
261 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
262 | ): ChildProcessByStdio<Writable, null, null>;
|
263 | function spawn(
|
264 | command: string,
|
265 | args: ReadonlyArray<string>,
|
266 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
267 | ): ChildProcessByStdio<null, Readable, null>;
|
268 | function spawn(
|
269 | command: string,
|
270 | args: ReadonlyArray<string>,
|
271 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
272 | ): ChildProcessByStdio<null, null, Readable>;
|
273 | function spawn(
|
274 | command: string,
|
275 | args: ReadonlyArray<string>,
|
276 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
277 | ): ChildProcessByStdio<null, null, null>;
|
278 |
|
279 | function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
|
280 |
|
281 | interface ExecOptions extends CommonOptions {
|
282 | shell?: string;
|
283 | maxBuffer?: number;
|
284 | killSignal?: NodeJS.Signals | number;
|
285 | }
|
286 |
|
287 | interface ExecOptionsWithStringEncoding extends ExecOptions {
|
288 | encoding: BufferEncoding;
|
289 | }
|
290 |
|
291 | interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
292 | encoding: BufferEncoding | null;
|
293 | }
|
294 |
|
295 | interface ExecException extends Error {
|
296 | cmd?: string;
|
297 | killed?: boolean;
|
298 | code?: number;
|
299 | signal?: NodeJS.Signals;
|
300 | }
|
301 |
|
302 |
|
303 | function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
304 |
|
305 |
|
306 | function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
307 |
|
308 |
|
309 | function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
310 |
|
311 |
|
312 |
|
313 | function exec(
|
314 | command: string,
|
315 | options: { encoding: BufferEncoding } & ExecOptions,
|
316 | callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
317 | ): ChildProcess;
|
318 |
|
319 |
|
320 | function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
321 |
|
322 |
|
323 | function exec(
|
324 | command: string,
|
325 | options: (BaseEncodingOptions & ExecOptions) | undefined | null,
|
326 | callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
327 | ): ChildProcess;
|
328 |
|
329 | interface PromiseWithChild<T> extends Promise<T> {
|
330 | child: ChildProcess;
|
331 | }
|
332 |
|
333 |
|
334 | namespace exec {
|
335 | function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
336 | function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
337 | function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
338 | function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
339 | function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
340 | }
|
341 |
|
342 | interface ExecFileOptions extends CommonOptions, Abortable {
|
343 | maxBuffer?: number;
|
344 | killSignal?: NodeJS.Signals | number;
|
345 | windowsVerbatimArguments?: boolean;
|
346 | shell?: boolean | string;
|
347 | signal?: AbortSignal;
|
348 | }
|
349 | interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
350 | encoding: BufferEncoding;
|
351 | }
|
352 | interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
353 | encoding: 'buffer' | null;
|
354 | }
|
355 | interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
356 | encoding: BufferEncoding;
|
357 | }
|
358 | type ExecFileException = ExecException & NodeJS.ErrnoException;
|
359 |
|
360 | function execFile(file: string): ChildProcess;
|
361 | function execFile(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
|
362 | function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
363 | function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
|
364 |
|
365 |
|
366 | function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
367 | function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
368 |
|
369 |
|
370 | function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
371 | function execFile(
|
372 | file: string,
|
373 | args: ReadonlyArray<string> | undefined | null,
|
374 | options: ExecFileOptionsWithBufferEncoding,
|
375 | callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
376 | ): ChildProcess;
|
377 |
|
378 |
|
379 | function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
380 | function execFile(
|
381 | file: string,
|
382 | args: ReadonlyArray<string> | undefined | null,
|
383 | options: ExecFileOptionsWithStringEncoding,
|
384 | callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
385 | ): ChildProcess;
|
386 |
|
387 |
|
388 |
|
389 | function execFile(
|
390 | file: string,
|
391 | options: ExecFileOptionsWithOtherEncoding,
|
392 | callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
393 | ): ChildProcess;
|
394 | function execFile(
|
395 | file: string,
|
396 | args: ReadonlyArray<string> | undefined | null,
|
397 | options: ExecFileOptionsWithOtherEncoding,
|
398 | callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
399 | ): ChildProcess;
|
400 |
|
401 |
|
402 | function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
403 | function execFile(
|
404 | file: string,
|
405 | args: ReadonlyArray<string> | undefined | null,
|
406 | options: ExecFileOptions,
|
407 | callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
|
408 | ): ChildProcess;
|
409 |
|
410 |
|
411 | function execFile(
|
412 | file: string,
|
413 | options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
|
414 | callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
415 | ): ChildProcess;
|
416 | function execFile(
|
417 | file: string,
|
418 | args: ReadonlyArray<string> | undefined | null,
|
419 | options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
|
420 | callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
421 | ): ChildProcess;
|
422 |
|
423 |
|
424 | namespace execFile {
|
425 | function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
426 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
|
427 | function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
428 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
429 | function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
430 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
431 | function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
432 | function __promisify__(
|
433 | file: string,
|
434 | args: ReadonlyArray<string> | undefined | null,
|
435 | options: ExecFileOptionsWithOtherEncoding,
|
436 | ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
437 | function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
438 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
439 | function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
440 | function __promisify__(
|
441 | file: string,
|
442 | args: ReadonlyArray<string> | undefined | null,
|
443 | options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
|
444 | ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
445 | }
|
446 |
|
447 | interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
448 | execPath?: string;
|
449 | execArgv?: string[];
|
450 | silent?: boolean;
|
451 | stdio?: StdioOptions;
|
452 | detached?: boolean;
|
453 | windowsVerbatimArguments?: boolean;
|
454 | }
|
455 | function fork(modulePath: string, options?: ForkOptions): ChildProcess;
|
456 | function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
457 |
|
458 | interface SpawnSyncOptions extends CommonSpawnOptions {
|
459 | input?: string | NodeJS.ArrayBufferView;
|
460 | maxBuffer?: number;
|
461 | encoding?: BufferEncoding | 'buffer' | null;
|
462 | }
|
463 | interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
464 | encoding: BufferEncoding;
|
465 | }
|
466 | interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
467 | encoding?: 'buffer' | null;
|
468 | }
|
469 | interface SpawnSyncReturns<T> {
|
470 | pid: number;
|
471 | output: string[];
|
472 | stdout: T;
|
473 | stderr: T;
|
474 | status: number | null;
|
475 | signal: NodeJS.Signals | null;
|
476 | error?: Error;
|
477 | }
|
478 | function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
479 | function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
480 | function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
481 | function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
482 | function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
483 | function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
484 | function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
485 |
|
486 | interface ExecSyncOptions extends CommonOptions {
|
487 | input?: string | Uint8Array;
|
488 | stdio?: StdioOptions;
|
489 | shell?: string;
|
490 | killSignal?: NodeJS.Signals | number;
|
491 | maxBuffer?: number;
|
492 | encoding?: BufferEncoding | 'buffer' | null;
|
493 | }
|
494 | interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
495 | encoding: BufferEncoding;
|
496 | }
|
497 | interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
498 | encoding?: 'buffer' | null;
|
499 | }
|
500 | function execSync(command: string): Buffer;
|
501 | function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
|
502 | function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
|
503 | function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
504 |
|
505 | interface ExecFileSyncOptions extends CommonOptions {
|
506 | input?: string | NodeJS.ArrayBufferView;
|
507 | stdio?: StdioOptions;
|
508 | killSignal?: NodeJS.Signals | number;
|
509 | maxBuffer?: number;
|
510 | encoding?: BufferEncoding;
|
511 | shell?: boolean | string;
|
512 | }
|
513 | interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
514 | encoding: BufferEncoding;
|
515 | }
|
516 | interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
517 | encoding: BufferEncoding;
|
518 | }
|
519 | function execFileSync(command: string): Buffer;
|
520 | function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
521 | function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
522 | function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
523 | function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
524 | function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
525 | function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
|
526 | }
|