UNPKG

25.7 kBTypeScriptView Raw
1declare 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;
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, // stdin
17 Readable | null, // stdout
18 Readable | null, // stderr
19 Readable | Writable | null | undefined, // extra
20 Readable | Writable | null | undefined // extra
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 * events.EventEmitter
39 * 1. close
40 * 2. disconnect
41 * 3. error
42 * 4. exit
43 * 5. message
44 * 6. spawn
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 // return this object when stdio option is undefined or not specified
97 interface ChildProcessWithoutNullStreams extends ChildProcess {
98 stdin: Writable;
99 stdout: Readable;
100 stderr: Readable;
101 readonly stdio: [
102 Writable, // stdin
103 Readable, // stdout
104 Readable, // stderr
105 Readable | Writable | null | undefined, // extra, no modification
106 Readable | Writable | null | undefined // extra, no modification
107 ];
108 }
109
110 // return this object when stdio option is a tuple of 3
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, // extra, no modification
124 Readable | Writable | null | undefined // extra, no modification
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 {
139 /**
140 * Specify the kind of serialization used for sending messages between processes.
141 * @default 'json'
142 */
143 serialization?: SerializationType;
144 }
145
146 interface ProcessEnvOptions {
147 uid?: number;
148 gid?: number;
149 cwd?: string;
150 env?: NodeJS.ProcessEnv;
151 }
152
153 interface CommonOptions extends ProcessEnvOptions {
154 /**
155 * @default true
156 */
157 windowsHide?: boolean;
158 /**
159 * @default 0
160 */
161 timeout?: number;
162 }
163
164 interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
165 argv0?: string;
166 stdio?: StdioOptions;
167 shell?: boolean | string;
168 windowsVerbatimArguments?: boolean;
169 }
170
171 interface SpawnOptions extends CommonSpawnOptions {
172 detached?: boolean;
173 }
174
175 interface SpawnOptionsWithoutStdio extends SpawnOptions {
176 stdio?: StdioPipeNamed | StdioPipe[];
177 }
178
179 type StdioNull = 'inherit' | 'ignore' | Stream;
180 type StdioPipeNamed = 'pipe' | 'overlapped';
181 type StdioPipe = undefined | null | StdioPipeNamed;
182
183 interface SpawnOptionsWithStdioTuple<
184 Stdin extends StdioNull | StdioPipe,
185 Stdout extends StdioNull | StdioPipe,
186 Stderr extends StdioNull | StdioPipe,
187 > extends SpawnOptions {
188 stdio: [Stdin, Stdout, Stderr];
189 }
190
191 // overloads of spawn without 'args'
192 function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
193
194 function spawn(
195 command: string,
196 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
197 ): ChildProcessByStdio<Writable, Readable, Readable>;
198 function spawn(
199 command: string,
200 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
201 ): ChildProcessByStdio<Writable, Readable, null>;
202 function spawn(
203 command: string,
204 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
205 ): ChildProcessByStdio<Writable, null, Readable>;
206 function spawn(
207 command: string,
208 options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
209 ): ChildProcessByStdio<null, Readable, Readable>;
210 function spawn(
211 command: string,
212 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
213 ): ChildProcessByStdio<Writable, null, null>;
214 function spawn(
215 command: string,
216 options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
217 ): ChildProcessByStdio<null, Readable, null>;
218 function spawn(
219 command: string,
220 options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
221 ): ChildProcessByStdio<null, null, Readable>;
222 function spawn(
223 command: string,
224 options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
225 ): ChildProcessByStdio<null, null, null>;
226
227 function spawn(command: string, options: SpawnOptions): ChildProcess;
228
229 // overloads of spawn with 'args'
230 function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
231
232 function spawn(
233 command: string,
234 args: ReadonlyArray<string>,
235 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
236 ): ChildProcessByStdio<Writable, Readable, Readable>;
237 function spawn(
238 command: string,
239 args: ReadonlyArray<string>,
240 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
241 ): ChildProcessByStdio<Writable, Readable, null>;
242 function spawn(
243 command: string,
244 args: ReadonlyArray<string>,
245 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
246 ): ChildProcessByStdio<Writable, null, Readable>;
247 function spawn(
248 command: string,
249 args: ReadonlyArray<string>,
250 options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
251 ): ChildProcessByStdio<null, Readable, Readable>;
252 function spawn(
253 command: string,
254 args: ReadonlyArray<string>,
255 options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
256 ): ChildProcessByStdio<Writable, null, null>;
257 function spawn(
258 command: string,
259 args: ReadonlyArray<string>,
260 options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
261 ): ChildProcessByStdio<null, Readable, null>;
262 function spawn(
263 command: string,
264 args: ReadonlyArray<string>,
265 options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
266 ): ChildProcessByStdio<null, null, Readable>;
267 function spawn(
268 command: string,
269 args: ReadonlyArray<string>,
270 options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
271 ): ChildProcessByStdio<null, null, null>;
272
273 function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
274
275 interface ExecOptions extends CommonOptions {
276 shell?: string;
277 maxBuffer?: number;
278 killSignal?: NodeJS.Signals | number;
279 }
280
281 interface ExecOptionsWithStringEncoding extends ExecOptions {
282 encoding: BufferEncoding;
283 }
284
285 interface ExecOptionsWithBufferEncoding extends ExecOptions {
286 encoding: BufferEncoding | null; // specify `null`.
287 }
288
289 interface ExecException extends Error {
290 cmd?: string;
291 killed?: boolean;
292 code?: number;
293 signal?: NodeJS.Signals;
294 }
295
296 // no `options` definitely means stdout/stderr are `string`.
297 function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
298
299 // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
300 function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
301
302 // `options` with well known `encoding` means stdout/stderr are definitely `string`.
303 function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
304
305 // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
306 // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
307 function exec(
308 command: string,
309 options: { encoding: BufferEncoding } & ExecOptions,
310 callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
311 ): ChildProcess;
312
313 // `options` without an `encoding` means stdout/stderr are definitely `string`.
314 function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
315
316 // fallback if nothing else matches. Worst case is always `string | Buffer`.
317 function exec(
318 command: string,
319 options: (BaseEncodingOptions & ExecOptions) | undefined | null,
320 callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
321 ): ChildProcess;
322
323 interface PromiseWithChild<T> extends Promise<T> {
324 child: ChildProcess;
325 }
326
327 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
328 namespace exec {
329 function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>;
330 function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
331 function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
332 function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
333 function __promisify__(command: string, options?: (BaseEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
334 }
335
336 interface ExecFileOptions extends CommonOptions, Abortable {
337 maxBuffer?: number;
338 killSignal?: NodeJS.Signals | number;
339 windowsVerbatimArguments?: boolean;
340 shell?: boolean | string;
341 signal?: AbortSignal;
342 }
343 interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
344 encoding: BufferEncoding;
345 }
346 interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
347 encoding: 'buffer' | null;
348 }
349 interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
350 encoding: BufferEncoding;
351 }
352 type ExecFileException = ExecException & NodeJS.ErrnoException;
353
354 function execFile(file: string): ChildProcess;
355 function execFile(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
356 function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
357 function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
358
359 // no `options` definitely means stdout/stderr are `string`.
360 function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
361 function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
362
363 // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
364 function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
365 function execFile(
366 file: string,
367 args: ReadonlyArray<string> | undefined | null,
368 options: ExecFileOptionsWithBufferEncoding,
369 callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
370 ): ChildProcess;
371
372 // `options` with well known `encoding` means stdout/stderr are definitely `string`.
373 function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
374 function execFile(
375 file: string,
376 args: ReadonlyArray<string> | undefined | null,
377 options: ExecFileOptionsWithStringEncoding,
378 callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
379 ): ChildProcess;
380
381 // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
382 // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
383 function execFile(
384 file: string,
385 options: ExecFileOptionsWithOtherEncoding,
386 callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
387 ): ChildProcess;
388 function execFile(
389 file: string,
390 args: ReadonlyArray<string> | undefined | null,
391 options: ExecFileOptionsWithOtherEncoding,
392 callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
393 ): ChildProcess;
394
395 // `options` without an `encoding` means stdout/stderr are definitely `string`.
396 function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
397 function execFile(
398 file: string,
399 args: ReadonlyArray<string> | undefined | null,
400 options: ExecFileOptions,
401 callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
402 ): ChildProcess;
403
404 // fallback if nothing else matches. Worst case is always `string | Buffer`.
405 function execFile(
406 file: string,
407 options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
408 callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
409 ): ChildProcess;
410 function execFile(
411 file: string,
412 args: ReadonlyArray<string> | undefined | null,
413 options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
414 callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
415 ): ChildProcess;
416
417 // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
418 namespace execFile {
419 function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
420 function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
421 function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
422 function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
423 function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
424 function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
425 function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
426 function __promisify__(
427 file: string,
428 args: ReadonlyArray<string> | undefined | null,
429 options: ExecFileOptionsWithOtherEncoding,
430 ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
431 function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
432 function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
433 function __promisify__(file: string, options: (BaseEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
434 function __promisify__(
435 file: string,
436 args: ReadonlyArray<string> | undefined | null,
437 options: (BaseEncodingOptions & ExecFileOptions) | undefined | null,
438 ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
439 }
440
441 interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
442 execPath?: string;
443 execArgv?: string[];
444 silent?: boolean;
445 stdio?: StdioOptions;
446 detached?: boolean;
447 windowsVerbatimArguments?: boolean;
448 }
449 function fork(modulePath: string, options?: ForkOptions): ChildProcess;
450 function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
451
452 interface SpawnSyncOptions extends CommonSpawnOptions {
453 input?: string | NodeJS.ArrayBufferView;
454 killSignal?: NodeJS.Signals | number;
455 maxBuffer?: number;
456 encoding?: BufferEncoding | 'buffer' | null;
457 }
458 interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
459 encoding: BufferEncoding;
460 }
461 interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
462 encoding?: 'buffer' | null;
463 }
464 interface SpawnSyncReturns<T> {
465 pid: number;
466 output: string[];
467 stdout: T;
468 stderr: T;
469 status: number | null;
470 signal: NodeJS.Signals | null;
471 error?: Error;
472 }
473 function spawnSync(command: string): SpawnSyncReturns<Buffer>;
474 function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
475 function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
476 function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
477 function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
478 function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
479 function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
480
481 interface ExecSyncOptions extends CommonOptions {
482 input?: string | Uint8Array;
483 stdio?: StdioOptions;
484 shell?: string;
485 killSignal?: NodeJS.Signals | number;
486 maxBuffer?: number;
487 encoding?: BufferEncoding | 'buffer' | null;
488 }
489 interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
490 encoding: BufferEncoding;
491 }
492 interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
493 encoding?: 'buffer' | null;
494 }
495 function execSync(command: string): Buffer;
496 function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
497 function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
498 function execSync(command: string, options?: ExecSyncOptions): Buffer;
499
500 interface ExecFileSyncOptions extends CommonOptions {
501 input?: string | NodeJS.ArrayBufferView;
502 stdio?: StdioOptions;
503 killSignal?: NodeJS.Signals | number;
504 maxBuffer?: number;
505 encoding?: BufferEncoding;
506 shell?: boolean | string;
507 }
508 interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
509 encoding: BufferEncoding;
510 }
511 interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
512 encoding: BufferEncoding; // specify `null`.
513 }
514 function execFileSync(command: string): Buffer;
515 function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
516 function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
517 function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
518 function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
519 function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
520 function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
521}