Skip to content

Commit 55176eb

Browse files
committed
fix: Run ppx as main, not standalone
1 parent f3e0bb1 commit 55176eb

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

bin/Bin.re

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
let () = Ppxlib.Driver.standalone();
1+
let argv =
2+
switch (Sys.argv |> Array.to_list) {
3+
| [program, ...rest] =>
4+
switch (List.rev(rest)) {
5+
| [output_file, input_file, ...args] =>
6+
List.concat([
7+
[program],
8+
List.rev(args),
9+
[input_file, "-o", output_file, "--dump-ast"],
10+
])
11+
|> Array.of_list
12+
| _ => Sys.argv
13+
}
14+
| _ => Sys.argv
15+
};
16+
17+
let () = Migrate_parsetree.Driver.run_main(~argv, ());

test/dune

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
; expect the process to fail, capturing stderr
1010
(with-stderr-to
1111
%{targets}
12-
(bash "! ./%{pp} -no-color -impl %{input}")
12+
(bash "! ./%{pp} %{input}")
1313
)
1414
)
1515
)
@@ -36,7 +36,7 @@
3636
; expect the process to fail, capturing stderr
3737
(with-stderr-to
3838
%{targets}
39-
(bash "! ./%{pp} -no-color -impl %{input}")
39+
(bash "! ./%{pp} %{input}")
4040
)
4141
)
4242
)
@@ -63,7 +63,7 @@
6363
; expect the process to fail, capturing stderr
6464
(with-stderr-to
6565
%{targets}
66-
(bash "! ./%{pp} -no-color -impl %{input}")
66+
(bash "! ./%{pp} %{input}")
6767
)
6868
)
6969
)
@@ -90,7 +90,7 @@
9090
; expect the process to fail, capturing stderr
9191
(with-stderr-to
9292
%{targets}
93-
(bash "! ./%{pp} -no-color -impl %{input}")
93+
(bash "! ./%{pp} %{input}")
9494
)
9595
)
9696
)

0 commit comments

Comments
 (0)