Skip to content

Commit

Permalink
(ocaml) Fix: calling piqic-ocaml --pp in non-terminal mode
Browse files Browse the repository at this point in the history
Add -printer o to the arguments of camlp4o when --pp is used in piqic-ocaml

(It used to be there but was removed by mistake during piqic-ocaml rewrite.)

Camlp4o uses the Camlp4AutoPrinter by default (no -printer argument
provided), which will either produce ocaml code or a binary AST
depending on whether the output is a terminal or not (regardless of any
-o option provided). If piqic-ocaml is run from a process that is not
started on a terminal, the results of piqic-ocaml --pp was a binary AST
file.
  • Loading branch information
kdkeyser authored and alavrik committed Feb 1, 2014
1 parent f8bb0d3 commit 2c37fe4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion piqic-ocaml/piqic_ocaml.ml
Expand Up @@ -89,7 +89,12 @@ let arg__strict =


let ocaml_pretty_print ifile ofile =
let cmd = Printf.sprintf "camlp4o -o %s %s" ofile ifile in
(* NOTE: we need "-printer o", because Camlp4o uses the Camlp4AutoPrinter by
* default (no -printer argument provided), which will either produce ocaml
* code or a binary AST depending on whether the output is a terminal or not
* (regardless of any -o option provided). started on a terminal, the results
* of piqic-ocaml --pp was a binary AST file *)
let cmd = Printf.sprintf "camlp4o -printer o -o %s %s" ofile ifile in
let res = Sys.command cmd in
if res <> 0
then C.error ("command execution failed: " ^ cmd)
Expand Down

0 comments on commit 2c37fe4

Please sign in to comment.