1 | declare module 'child_process' {
|
2 | import { ObjectEncodingOptions } 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 | undefined;
|
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 | undefined;
|
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 | undefined;
|
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 | undefined;
|
144 |
|
145 | |
146 |
|
147 |
|
148 |
|
149 | killSignal?: NodeJS.Signals | number | undefined;
|
150 |
|
151 | |
152 |
|
153 |
|
154 | timeout?: number | undefined;
|
155 | }
|
156 |
|
157 | interface ProcessEnvOptions {
|
158 | uid?: number | undefined;
|
159 | gid?: number | undefined;
|
160 | cwd?: string | undefined;
|
161 | env?: NodeJS.ProcessEnv | undefined;
|
162 | }
|
163 |
|
164 | interface CommonOptions extends ProcessEnvOptions {
|
165 | |
166 |
|
167 |
|
168 | windowsHide?: boolean | undefined;
|
169 | |
170 |
|
171 |
|
172 | timeout?: number | undefined;
|
173 | }
|
174 |
|
175 | interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
|
176 | argv0?: string | undefined;
|
177 | stdio?: StdioOptions | undefined;
|
178 | shell?: boolean | string | undefined;
|
179 | windowsVerbatimArguments?: boolean | undefined;
|
180 | }
|
181 |
|
182 | interface SpawnOptions extends CommonSpawnOptions {
|
183 | detached?: boolean | undefined;
|
184 | }
|
185 |
|
186 | interface SpawnOptionsWithoutStdio extends SpawnOptions {
|
187 | stdio?: StdioPipeNamed | StdioPipe[] | undefined;
|
188 | }
|
189 |
|
190 | type StdioNull = 'inherit' | 'ignore' | Stream;
|
191 | type StdioPipeNamed = 'pipe' | 'overlapped';
|
192 | type StdioPipe = undefined | null | StdioPipeNamed;
|
193 |
|
194 | interface SpawnOptionsWithStdioTuple<
|
195 | Stdin extends StdioNull | StdioPipe,
|
196 | Stdout extends StdioNull | StdioPipe,
|
197 | Stderr extends StdioNull | StdioPipe,
|
198 | > extends SpawnOptions {
|
199 | stdio: [Stdin, Stdout, Stderr];
|
200 | }
|
201 |
|
202 |
|
203 | function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
204 |
|
205 | function spawn(
|
206 | command: string,
|
207 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
208 | ): ChildProcessByStdio<Writable, Readable, Readable>;
|
209 | function spawn(
|
210 | command: string,
|
211 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
212 | ): ChildProcessByStdio<Writable, Readable, null>;
|
213 | function spawn(
|
214 | command: string,
|
215 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
216 | ): ChildProcessByStdio<Writable, null, Readable>;
|
217 | function spawn(
|
218 | command: string,
|
219 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
220 | ): ChildProcessByStdio<null, Readable, Readable>;
|
221 | function spawn(
|
222 | command: string,
|
223 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
224 | ): ChildProcessByStdio<Writable, null, null>;
|
225 | function spawn(
|
226 | command: string,
|
227 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
228 | ): ChildProcessByStdio<null, Readable, null>;
|
229 | function spawn(
|
230 | command: string,
|
231 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
232 | ): ChildProcessByStdio<null, null, Readable>;
|
233 | function spawn(
|
234 | command: string,
|
235 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
236 | ): ChildProcessByStdio<null, null, null>;
|
237 |
|
238 | function spawn(command: string, options: SpawnOptions): ChildProcess;
|
239 |
|
240 |
|
241 | function spawn(command: string, args?: ReadonlyArray<string>, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
|
242 |
|
243 | function spawn(
|
244 | command: string,
|
245 | args: ReadonlyArray<string>,
|
246 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>,
|
247 | ): ChildProcessByStdio<Writable, Readable, Readable>;
|
248 | function spawn(
|
249 | command: string,
|
250 | args: ReadonlyArray<string>,
|
251 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>,
|
252 | ): ChildProcessByStdio<Writable, Readable, null>;
|
253 | function spawn(
|
254 | command: string,
|
255 | args: ReadonlyArray<string>,
|
256 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>,
|
257 | ): ChildProcessByStdio<Writable, null, Readable>;
|
258 | function spawn(
|
259 | command: string,
|
260 | args: ReadonlyArray<string>,
|
261 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>,
|
262 | ): ChildProcessByStdio<null, Readable, Readable>;
|
263 | function spawn(
|
264 | command: string,
|
265 | args: ReadonlyArray<string>,
|
266 | options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>,
|
267 | ): ChildProcessByStdio<Writable, null, null>;
|
268 | function spawn(
|
269 | command: string,
|
270 | args: ReadonlyArray<string>,
|
271 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>,
|
272 | ): ChildProcessByStdio<null, Readable, null>;
|
273 | function spawn(
|
274 | command: string,
|
275 | args: ReadonlyArray<string>,
|
276 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>,
|
277 | ): ChildProcessByStdio<null, null, Readable>;
|
278 | function spawn(
|
279 | command: string,
|
280 | args: ReadonlyArray<string>,
|
281 | options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>,
|
282 | ): ChildProcessByStdio<null, null, null>;
|
283 |
|
284 | function spawn(command: string, args: ReadonlyArray<string>, options: SpawnOptions): ChildProcess;
|
285 |
|
286 | interface ExecOptions extends CommonOptions {
|
287 | shell?: string | undefined;
|
288 | maxBuffer?: number | undefined;
|
289 | killSignal?: NodeJS.Signals | number | undefined;
|
290 | }
|
291 |
|
292 | interface ExecOptionsWithStringEncoding extends ExecOptions {
|
293 | encoding: BufferEncoding;
|
294 | }
|
295 |
|
296 | interface ExecOptionsWithBufferEncoding extends ExecOptions {
|
297 | encoding: BufferEncoding | null;
|
298 | }
|
299 |
|
300 | interface ExecException extends Error {
|
301 | cmd?: string | undefined;
|
302 | killed?: boolean | undefined;
|
303 | code?: number | undefined;
|
304 | signal?: NodeJS.Signals | undefined;
|
305 | }
|
306 |
|
307 |
|
308 | function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
309 |
|
310 |
|
311 | function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
312 |
|
313 |
|
314 | function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
315 |
|
316 |
|
317 |
|
318 | function exec(
|
319 | command: string,
|
320 | options: { encoding: BufferEncoding } & ExecOptions,
|
321 | callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
322 | ): ChildProcess;
|
323 |
|
324 |
|
325 | function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
|
326 |
|
327 |
|
328 | function exec(
|
329 | command: string,
|
330 | options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
|
331 | callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
332 | ): ChildProcess;
|
333 |
|
334 | interface PromiseWithChild<T> extends Promise<T> {
|
335 | child: ChildProcess;
|
336 | }
|
337 |
|
338 |
|
339 | namespace exec {
|
340 | function __promisify__(command: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
341 | function __promisify__(command: string, options: { encoding: "buffer" | null } & ExecOptions): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
342 | function __promisify__(command: string, options: { encoding: BufferEncoding } & ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
343 | function __promisify__(command: string, options: ExecOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
344 | function __promisify__(command: string, options?: (ObjectEncodingOptions & ExecOptions) | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
345 | }
|
346 |
|
347 | interface ExecFileOptions extends CommonOptions, Abortable {
|
348 | maxBuffer?: number | undefined;
|
349 | killSignal?: NodeJS.Signals | number | undefined;
|
350 | windowsVerbatimArguments?: boolean | undefined;
|
351 | shell?: boolean | string | undefined;
|
352 | signal?: AbortSignal | undefined;
|
353 | }
|
354 | interface ExecFileOptionsWithStringEncoding extends ExecFileOptions {
|
355 | encoding: BufferEncoding;
|
356 | }
|
357 | interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
358 | encoding: 'buffer' | null;
|
359 | }
|
360 | interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
361 | encoding: BufferEncoding;
|
362 | }
|
363 | type ExecFileException = ExecException & NodeJS.ErrnoException;
|
364 |
|
365 | function execFile(file: string): ChildProcess;
|
366 | function execFile(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
|
367 | function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
368 | function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
|
369 |
|
370 |
|
371 | function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
372 | function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
373 |
|
374 |
|
375 | function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
376 | function execFile(
|
377 | file: string,
|
378 | args: ReadonlyArray<string> | undefined | null,
|
379 | options: ExecFileOptionsWithBufferEncoding,
|
380 | callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
|
381 | ): ChildProcess;
|
382 |
|
383 |
|
384 | function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
385 | function execFile(
|
386 | file: string,
|
387 | args: ReadonlyArray<string> | undefined | null,
|
388 | options: ExecFileOptionsWithStringEncoding,
|
389 | callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
|
390 | ): ChildProcess;
|
391 |
|
392 |
|
393 |
|
394 | function execFile(
|
395 | file: string,
|
396 | options: ExecFileOptionsWithOtherEncoding,
|
397 | callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
398 | ): ChildProcess;
|
399 | function execFile(
|
400 | file: string,
|
401 | args: ReadonlyArray<string> | undefined | null,
|
402 | options: ExecFileOptionsWithOtherEncoding,
|
403 | callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
404 | ): ChildProcess;
|
405 |
|
406 |
|
407 | function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
|
408 | function execFile(
|
409 | file: string,
|
410 | args: ReadonlyArray<string> | undefined | null,
|
411 | options: ExecFileOptions,
|
412 | callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
|
413 | ): ChildProcess;
|
414 |
|
415 |
|
416 | function execFile(
|
417 | file: string,
|
418 | options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
419 | callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
420 | ): ChildProcess;
|
421 | function execFile(
|
422 | file: string,
|
423 | args: ReadonlyArray<string> | undefined | null,
|
424 | options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
425 | callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null,
|
426 | ): ChildProcess;
|
427 |
|
428 |
|
429 | namespace execFile {
|
430 | function __promisify__(file: string): PromiseWithChild<{ stdout: string, stderr: string }>;
|
431 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null): PromiseWithChild<{ stdout: string, stderr: string }>;
|
432 | function __promisify__(file: string, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
433 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding): PromiseWithChild<{ stdout: Buffer, stderr: Buffer }>;
|
434 | function __promisify__(file: string, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
435 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding): PromiseWithChild<{ stdout: string, stderr: string }>;
|
436 | function __promisify__(file: string, options: ExecFileOptionsWithOtherEncoding): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
437 | function __promisify__(
|
438 | file: string,
|
439 | args: ReadonlyArray<string> | undefined | null,
|
440 | options: ExecFileOptionsWithOtherEncoding,
|
441 | ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
442 | function __promisify__(file: string, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
443 | function __promisify__(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions): PromiseWithChild<{ stdout: string, stderr: string }>;
|
444 | function __promisify__(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
445 | function __promisify__(
|
446 | file: string,
|
447 | args: ReadonlyArray<string> | undefined | null,
|
448 | options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
|
449 | ): PromiseWithChild<{ stdout: string | Buffer, stderr: string | Buffer }>;
|
450 | }
|
451 |
|
452 | interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable {
|
453 | execPath?: string | undefined;
|
454 | execArgv?: string[] | undefined;
|
455 | silent?: boolean | undefined;
|
456 | stdio?: StdioOptions | undefined;
|
457 | detached?: boolean | undefined;
|
458 | windowsVerbatimArguments?: boolean | undefined;
|
459 | }
|
460 | function fork(modulePath: string, options?: ForkOptions): ChildProcess;
|
461 | function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
462 |
|
463 | interface SpawnSyncOptions extends CommonSpawnOptions {
|
464 | input?: string | NodeJS.ArrayBufferView | undefined;
|
465 | maxBuffer?: number | undefined;
|
466 | encoding?: BufferEncoding | 'buffer' | null | undefined;
|
467 | }
|
468 | interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
|
469 | encoding: BufferEncoding;
|
470 | }
|
471 | interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
|
472 | encoding?: 'buffer' | null | undefined;
|
473 | }
|
474 | interface SpawnSyncReturns<T> {
|
475 | pid: number;
|
476 | output: string[];
|
477 | stdout: T;
|
478 | stderr: T;
|
479 | status: number | null;
|
480 | signal: NodeJS.Signals | null;
|
481 | error?: Error | undefined;
|
482 | }
|
483 | function spawnSync(command: string): SpawnSyncReturns<Buffer>;
|
484 | function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
485 | function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
486 | function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
487 | function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
488 | function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
489 | function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
490 |
|
491 | interface CommonExecOptions extends CommonOptions {
|
492 | input?: string | NodeJS.ArrayBufferView | undefined;
|
493 | stdio?: StdioOptions | undefined;
|
494 | killSignal?: NodeJS.Signals | number | undefined;
|
495 | maxBuffer?: number | undefined;
|
496 | encoding?: BufferEncoding | 'buffer' | null | undefined;
|
497 | }
|
498 |
|
499 | interface ExecSyncOptions extends CommonExecOptions {
|
500 | shell?: string | undefined;
|
501 | }
|
502 | interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions {
|
503 | encoding: BufferEncoding;
|
504 | }
|
505 | interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
|
506 | encoding?: 'buffer' | null | undefined;
|
507 | }
|
508 | function execSync(command: string): Buffer;
|
509 | function execSync(command: string, options?: ExecSyncOptionsWithStringEncoding): string;
|
510 | function execSync(command: string, options?: ExecSyncOptionsWithBufferEncoding): Buffer;
|
511 | function execSync(command: string, options?: ExecSyncOptions): Buffer;
|
512 |
|
513 | interface ExecFileSyncOptions extends CommonExecOptions {
|
514 | shell?: boolean | string | undefined;
|
515 | }
|
516 | interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions {
|
517 | encoding: BufferEncoding;
|
518 | }
|
519 | interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
|
520 | encoding: BufferEncoding;
|
521 | }
|
522 | function execFileSync(command: string): Buffer;
|
523 | function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
524 | function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
525 | function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
526 | function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
527 | function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
528 | function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
|
529 | }
|
530 |
|
531 | declare module 'node:child_process' {
|
532 | export * from 'child_process';
|
533 | }
|