UNPKG

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