Skip to content

Commit 84420b6

Browse files
committed
fix incorrect types for 'exec', 'execSync' and other functions -- fixes issue #44 ;
1 parent f37c175 commit 84420b6

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/ChildProcess.re

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ external execOptions:
9393
(
9494
~cwd: string=?,
9595
~env: Js.Dict.t(string)=?,
96-
~encoding: string=?,
9796
~shell: string=?,
9897
~timeout: int=?,
9998
~maxBuffer: int=?,
@@ -106,12 +105,12 @@ external execOptions:
106105
execOptions;
107106

108107
[@bs.module "child_process"] [@bs.val]
109-
external exec: (string, (option(Js.Exn.t), string, string) => unit) => t =
108+
external exec: (string, (Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit) => t =
110109
"exec";
111110

112111
[@bs.module "child_process"] [@bs.val]
113112
external execWith:
114-
(string, execOptions, (option(Js.Exn.t), string, string) => unit) => t =
113+
(string, execOptions, (Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit) => t =
115114
"exec";
116115

117116
type execFileOptions;
@@ -121,7 +120,6 @@ external execFileOption:
121120
(
122121
~cwd: string=?,
123122
~env: Js.Dict.t(string)=?,
124-
~encoding: string=?,
125123
~timeout: int=?,
126124
~maxBuffer: int=?,
127125
~killSignal: string=?,
@@ -135,7 +133,7 @@ external execFileOption:
135133

136134
[@bs.module "child_process"] [@bs.val]
137135
external execFile:
138-
(string, array(string), (option(Js.Exn.t), string, string) => unit) => t =
136+
(string, array(string), (Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit) => t =
139137
"execFile";
140138

141139
[@bs.module "child_process"] [@bs.val]
@@ -144,7 +142,7 @@ external execFileWith:
144142
string,
145143
array(string),
146144
execFileOptions,
147-
(option(Js.Exn.t), string, string) => unit
145+
(Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit
148146
) =>
149147
t =
150148
"execFile";
@@ -202,11 +200,11 @@ external spawnWith: (string, array(string), spawnOptions) => t = "spawn";
202200
type spawnSyncResult('a) = {
203201
pid: int,
204202
output: array('a),
205-
stdout: string,
206-
stderr: string,
203+
stdout: Buffer.t,
204+
stderr: Buffer.t,
207205
status: int,
208-
signal: Js.Nullable.t(string),
209-
error: option(Js.Exn.t),
206+
signal: Js.nullable(string),
207+
error: Js.nullable(Js.Exn.t),
210208
};
211209

212210
type spawnSyncOptions;
@@ -247,7 +245,6 @@ external execSyncOptions:
247245
~cwd: string=?,
248246
~env: Js.Dict.t(string)=?,
249247
~input: Buffer.t=?,
250-
~encoding: string=?,
251248
~shell: string=?,
252249
~timeout: int=?,
253250
~maxBuffer: int=?,
@@ -260,10 +257,10 @@ external execSyncOptions:
260257
execSyncOptions;
261258

262259
[@bs.module "child_process"] [@bs.val]
263-
external execSync: string => string = "execSync";
260+
external execSync: string => Buffer.t = "execSync";
264261

265262
[@bs.module "child_process"] [@bs.val]
266-
external execSyncWith: (string, execSyncOptions) => string = "execSync";
263+
external execSyncWith: (string, execSyncOptions) => Buffer.t = "execSync";
267264

268265
type execFileSyncOptions;
269266

@@ -273,7 +270,6 @@ external execFileSyncOptions:
273270
~cwd: string=?,
274271
~env: Js.Dict.t(string)=?,
275272
~input: Buffer.t=?,
276-
~encoding: string=?,
277273
~shell: string=?,
278274
~timeout: int=?,
279275
~maxBuffer: int=?,
@@ -286,9 +282,9 @@ external execFileSyncOptions:
286282
execFileSyncOptions;
287283

288284
[@bs.module "child_process"] [@bs.val]
289-
external execFileSync: (string, array(string)) => string = "execFileSync";
285+
external execFileSync: (string, array(string)) => Buffer.t = "execFileSync";
290286

291287
[@bs.module "child_process"] [@bs.val]
292288
external execFileSyncWith:
293-
(string, array(string), execFileSyncOptions) => string =
289+
(string, array(string), execFileSyncOptions) => Buffer.t =
294290
"execFileSync";

0 commit comments

Comments
 (0)