UNPKG

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