1 |
|
2 |
|
3 |
|
4 | import {
|
5 | ChildProcess,
|
6 | ExecException,
|
7 | ExecFileOptions,
|
8 | ExecFileOptionsWithStringEncoding,
|
9 | ExecOptions,
|
10 | } from "child_process";
|
11 | export * from "child_process";
|
12 |
|
13 | export function exec(
|
14 | command: string,
|
15 | callback: (error: ExecException | null, stdout: string, stderr: string) => void,
|
16 | ): ChildProcess;
|
17 | export function exec(
|
18 | command: string,
|
19 | options: { encoding: "buffer" | null | undefined } & ExecOptions,
|
20 | callback: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
|
21 | ): ChildProcess;
|
22 | export function exec(
|
23 | command: string,
|
24 | options: ({ encoding?: BufferEncoding | undefined } & ExecOptions) | null | undefined,
|
25 | callback: (error: ExecException | null, stdout: string, stderr: string) => void,
|
26 | ): ChildProcess;
|
27 | export function exec(
|
28 | command: string,
|
29 | options: ({ encoding?: string | null | undefined } & ExecOptions) | null | undefined,
|
30 | callback: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
31 | ): ChildProcess;
|
32 |
|
33 | export function exec(
|
34 | command: string,
|
35 | options: { encoding: "buffer" | null | undefined } & ExecOptions,
|
36 | ): Promise<[Buffer, Buffer]>;
|
37 | export function exec(
|
38 | command: string,
|
39 | options?: ({ encoding?: BufferEncoding | undefined } & ExecOptions) | null,
|
40 | ): Promise<[string, string]>;
|
41 | export function exec(
|
42 | command: string,
|
43 | options?: ({ encoding?: string | null | undefined } & ExecOptions) | null,
|
44 | ): Promise<[string | Buffer, string | Buffer]>;
|
45 |
|
46 | interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
|
47 | encoding: "buffer" | null | undefined;
|
48 | }
|
49 |
|
50 | interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
|
51 | encoding?: string | null | undefined;
|
52 | }
|
53 |
|
54 |
|
55 | export function execFile(
|
56 | file: string,
|
57 | callback: (error: Error | null, stdout: string, stderr: string) => void,
|
58 | ): ChildProcess;
|
59 | export function execFile(
|
60 | file: string,
|
61 | args: readonly string[] | null | undefined,
|
62 | callback: (error: Error | null, stdout: string, stderr: string) => void,
|
63 | ): ChildProcess;
|
64 |
|
65 |
|
66 | export function execFile(
|
67 | file: string,
|
68 | options: ExecFileOptionsWithBufferEncoding,
|
69 | callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void,
|
70 | ): ChildProcess;
|
71 | export function execFile(
|
72 | file: string,
|
73 | args: readonly string[] | null | undefined,
|
74 | options: ExecFileOptionsWithBufferEncoding,
|
75 | callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void,
|
76 | ): ChildProcess;
|
77 |
|
78 |
|
79 | export function execFile(
|
80 | file: string,
|
81 |
|
82 |
|
83 | options: ExecFileOptions | ExecFileOptionsWithStringEncoding,
|
84 | callback: (error: Error | null, stdout: string, stderr: string) => void,
|
85 | ): ChildProcess;
|
86 | export function execFile(
|
87 | file: string,
|
88 | args: readonly string[] | null | undefined,
|
89 | options: ExecFileOptions | ExecFileOptionsWithStringEncoding,
|
90 | callback: (error: Error | null, stdout: string, stderr: string) => void,
|
91 | ): ChildProcess;
|
92 |
|
93 |
|
94 |
|
95 | export function execFile(
|
96 | file: string,
|
97 | options: ExecFileOptionsWithOtherEncoding | null | undefined,
|
98 | callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
99 | ): ChildProcess;
|
100 | export function execFile(
|
101 | file: string,
|
102 | args: readonly string[] | null | undefined,
|
103 | options: ExecFileOptionsWithOtherEncoding | null | undefined,
|
104 | callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void,
|
105 | ): ChildProcess;
|
106 |
|
107 | export function execFile(
|
108 | file: string,
|
109 | args: string[] | null | undefined,
|
110 | options: ExecFileOptionsWithBufferEncoding,
|
111 | ): Promise<[Buffer, Buffer]>;
|
112 | export function execFile(file: string, options: ExecFileOptionsWithBufferEncoding): Promise<[Buffer, Buffer]>;
|
113 | export function execFile(
|
114 | file: string,
|
115 | args?: string[] | null,
|
116 | options?: ExecFileOptions | ExecFileOptionsWithStringEncoding | null,
|
117 | ): Promise<[string, string]>;
|
118 | export function execFile(
|
119 | file: string,
|
120 | options?: ExecFileOptions | ExecFileOptionsWithStringEncoding | null,
|
121 | ): Promise<[string, string]>;
|
122 | export function execFile(
|
123 | file: string,
|
124 | args?: string[] | null,
|
125 | options?: ExecFileOptionsWithOtherEncoding | null,
|
126 | ): Promise<[string | Buffer, string | Buffer]>;
|
127 | export function execFile(
|
128 | file: string,
|
129 | options?: ExecFileOptionsWithOtherEncoding | null,
|
130 | ): Promise<[string | Buffer, string | Buffer]>;
|