Skip to content

Commit

Permalink
fix: Run ppx as main, not standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Oct 19, 2020
1 parent f3e0bb1 commit 55176eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
18 changes: 17 additions & 1 deletion bin/Bin.re
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
let () = Ppxlib.Driver.standalone();
let argv =
switch (Sys.argv |> Array.to_list) {
| [program, ...rest] =>
switch (List.rev(rest)) {
| [output_file, input_file, ...args] =>
List.concat([
[program],
List.rev(args),
[input_file, "-o", output_file, "--dump-ast"],
])
|> Array.of_list
| _ => Sys.argv
}
| _ => Sys.argv
};

let () = Migrate_parsetree.Driver.run_main(~argv, ());
8 changes: 4 additions & 4 deletions test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
; expect the process to fail, capturing stderr
(with-stderr-to
%{targets}
(bash "! ./%{pp} -no-color -impl %{input}")
(bash "! ./%{pp} %{input}")
)
)
)
Expand All @@ -36,7 +36,7 @@
; expect the process to fail, capturing stderr
(with-stderr-to
%{targets}
(bash "! ./%{pp} -no-color -impl %{input}")
(bash "! ./%{pp} %{input}")
)
)
)
Expand All @@ -63,7 +63,7 @@
; expect the process to fail, capturing stderr
(with-stderr-to
%{targets}
(bash "! ./%{pp} -no-color -impl %{input}")
(bash "! ./%{pp} %{input}")
)
)
)
Expand All @@ -90,7 +90,7 @@
; expect the process to fail, capturing stderr
(with-stderr-to
%{targets}
(bash "! ./%{pp} -no-color -impl %{input}")
(bash "! ./%{pp} %{input}")
)
)
)
Expand Down

0 comments on commit 55176eb

Please sign in to comment.