]> matita.cs.unibo.it Git - fireball-separation.git/blob - ocaml/ptest.ml
andrea7 -> new andrea9
[fireball-separation.git] / ocaml / ptest.ml
1 open Unix;;
2 let process_output_to_list2 = fun command ->
3   let chan = open_process_in command in
4   let res = ref ([] : string list) in
5   let rec process_otl_aux () =
6     let e = input_line chan in
7     res := e::!res;
8     process_otl_aux() in
9   try process_otl_aux ()
10   with End_of_file ->
11     let stat = close_process_in chan in (List.rev !res,stat)
12 let cmd_to_list command =
13   let (l,_) = process_output_to_list2 command in l;;
14
15 let lines = cmd_to_list "tput cols" in
16 prerr_endline (List.hd (lines));;