File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,23 @@ let () =
2121 expect(Execa . commandSync("ls __tests__/execa_spec.re" , () ))
2222 |> toEqual(res)
2323 );
24+
25+ let options = Execa . options(~shell= false , ~encoding= Js . Nullable . null, () );
26+ let res = Execa . child_process_result_buffer(
27+ ~command= "ls __tests__/execa_spec.re" ,
28+ ~exitCode= 0 ,
29+ ~stdout= Node . Buffer . fromString("__tests__/execa_spec.re" ),
30+ ~stderr= Node . Buffer . fromString("" ),
31+ ~isCanceled= false ,
32+ ~killed= false ,
33+ ~timedOut= false ,
34+ ~failed= false
35+ );
36+
37+ test("#commandSyncBuffer works with options" , () =>
38+ expect(Execa . commandSyncBuffer("ls __tests__/execa_spec.re" , ~options, () ))
39+ |> toEqual(res)
40+ );
2441 }
2542 ),
2643 );
Original file line number Diff line number Diff line change @@ -10,6 +10,18 @@ type child_process_result = {
1010 failed: bool ,
1111};
1212
13+ [@ bs . deriving abstract]
14+ type child_process_result_buffer = {
15+ command: string ,
16+ exitCode: int ,
17+ stdout: Node . Buffer . t ,
18+ stderr: Node . Buffer . t ,
19+ isCanceled: bool ,
20+ killed: bool ,
21+ timedOut: bool ,
22+ failed: bool ,
23+ };
24+
1325[@ bs . deriving abstract]
1426type options = {
1527 shell: bool ,
@@ -23,6 +35,9 @@ type options = {
2335 stdio: string ,
2436 [@bs.optional]
2537 env: Js . Dict . t (string ),
38+ [@bs.optional]
39+ encoding: Js . Nullable . t (string )
2640};
2741
2842[@ bs . module "execa" ] external commandSync : string => ~options :options = ? => unit => child_process_result = "commandSync" ;
43+ [@ bs . module "execa" ] external commandSyncBuffer : string => ~options :options = ? => unit => child_process_result_buffer = "commandSync" ;
You can’t perform that action at this time.
0 commit comments