=== modified file 'Makefile' --- Makefile 2019-04-12 00:15:26 +0000 +++ Makefile 2019-04-11 18:49:43 +0000 @@ -3,7 +3,7 @@ clean: rm -rf _build *.o *.bc *.cm[iox] -ppio.bc: subprocess.cmo ppio.cmo compile +ppio.bc: subprocess.cmx ppio.cmx compile ./compile subprocess.cmo ppio.cmo -o ppio.bc %.cmx: %.ml compile === modified file 'compile' --- compile 2019-04-12 00:15:26 +0000 +++ compile 2019-04-11 18:49:43 +0000 @@ -2,7 +2,6 @@ set -x exec ocamlfind ocamlc \ -linkpkg \ - -package async \ -package async_unix \ -package core \ -package base \ === modified file 'ppio.ml' --- ppio.ml 2019-04-12 00:15:26 +0000 +++ ppio.ml 2019-04-11 19:04:04 +0000 @@ -57,38 +57,6 @@ Out_channel.flush stderr; ;; -(* Copy data from the reader to the writer, using the provided buffer - as scratch space *) -let rec copy_blocks buffer r w cb = - let open Async in - Reader.read r buffer - >>= function - | `Eof -> - cb 0 buffer; - Reader.close r - | `Ok bytes_read -> - cb bytes_read buffer; - Writer.write w (Bytes.to_string buffer) ~len:bytes_read; - Writer.flushed w - >>= fun () -> - copy_blocks buffer r w cb -;; - -let copy_cb info fd_in fd_out cb = - (* let buffer = Bytes.to_string (Bytes.create (16 * 1024)) in *) - let buffer = Bytes.create (16 * 1024) in - let create file_descr kind = - Async.Unix.Fd.create Fifo file_descr (Info.tag info ~tag:kind) - in - copy_blocks - buffer - (Async.Reader.create (create fd_in "reader")) - (Async.Writer.create (create fd_out "writer")) - cb -;; - -let cb_null (len:int) (buf:Bytes.t) = ();; - let main {hideendl; endl; color; exe} = pe ((show_cmd_args {hideendl; endl; color; exe})^"\n"); let fd0 = Unix.File_descr.of_int 0 in @@ -111,14 +79,8 @@ (List.nth_exn exe 0) (List.to_array exe) in printf "pid: %d\n%!" pid; - let open Async in - Deferred.all_unit [ - copy_cb (Info.of_string "stdin") fd0 stdin_w cb_null; - copy_cb (Info.of_string "stdout") stdout_r fd1 cb_null; - ] >>= (fun () -> - let _, status = Subprocess.waitpid [] pid in - exit (Subprocess.wait_estatus status); - ) + let _, status = Subprocess.waitpid [] pid in + exit (Subprocess.wait_estatus status); ;; let cmd = @@ -128,7 +90,7 @@ | true -> Some value | false -> None) in - Async.Command.async ~summary:"Pretty print I/O to a spawned command." + Command.basic ~summary:"Pretty print I/O to a spawned command." [%map_open let hide = flag "-H" ~aliases:["--hide-newlines"] no_arg ~doc:"Suppress printing codes of the line-terminating sequence"