=== modified file '.bzrignore' --- .bzrignore 2019-04-11 18:49:43 +0000 +++ .bzrignore 2019-04-11 14:01:44 +0000 @@ -1,4 +1,3 @@ _build *.cmi *.cmo -ppio.bc === modified file 'Makefile' --- Makefile 2019-04-11 18:49:43 +0000 +++ Makefile 2019-04-11 14:01:44 +0000 @@ -3,8 +3,5 @@ clean: rm -rf _build *.o *.bc *.cm[iox] -ppio.bc: subprocess.cmx ppio.cmx compile - ./compile subprocess.cmo ppio.cmo -o ppio.bc - -%.cmx: %.ml compile - ./compile -c $< +ppio.bc: ppio.ml compile + ./compile ppio.ml -o ppio.bc === modified file 'compile' --- compile 2019-04-11 18:49:43 +0000 +++ compile 2019-04-11 14:01:44 +0000 @@ -2,9 +2,7 @@ set -x exec ocamlfind ocamlc \ -linkpkg \ - -package async_unix \ -package core \ - -package base \ -package ppx_deriving \ -package ppx_deriving.show \ -package ppx_let \ === modified file 'ppio.ml' --- ppio.ml 2019-04-11 18:49:43 +0000 +++ ppio.ml 2019-04-11 16:36:33 +0000 @@ -1,7 +1,6 @@ (* vim: fileencoding=utf8 ft=ocaml et sw=2 ts=4 sts=4 *) open Core -(* open Async *) let do_echo_prompt () = Out_channel.output_string stdout "prompt: "; @@ -57,17 +56,6 @@ Out_channel.flush stderr; ;; -let main {hideendl; endl; color; exe} = - pe ((show_cmd_args {hideendl; endl; color; exe})^"\n"); - let pid = Subprocess.create_process - ~redirects:[] - (List.nth_exn exe 0) (List.to_array exe) - in - printf "pid: %d\n%!" pid; - let _, status = Subprocess.waitpid [] pid in - exit (Subprocess.wait_estatus status); -;; - let cmd = let open Command.Let_syntax in let flag_const value = @@ -121,9 +109,8 @@ ); } in - (* print_cmd_args args; *) - (* pe (show_cmd_args args); *) - main args; + print_cmd_args args; + pe (show_cmd_args args); ] ;; === removed file 'subprocess.ml' --- subprocess.ml 2019-04-11 18:49:43 +0000 +++ subprocess.ml 1970-01-01 00:00:00 +0000 @@ -1,45 +0,0 @@ -open Base;; - -type fd_operation = - | Redirect of Unix.file_descr - | Dup of Unix.file_descr - | Close -;; - -let perform_redirection fd operation = - match operation with - | Close -> Unix.close fd; - | Dup fd_from -> Unix.dup2 ~cloexec:false fd_from fd; - | Redirect fd_from -> - Unix.dup2 ~cloexec:false fd_from fd; - Unix.close fd_from; -;; - -external sys_exit : int -> 'a = "caml_sys_exit" - -let create_process ?redirects cmd args = - (* let redirects = Option.value redirects [] *) - let redirects = match redirects with - | Some l -> l - | None -> [] - in - match Unix.fork() with - 0 -> - begin try - List.iter redirects ( - fun (fd, operation) -> perform_redirection fd operation - ); - Unix.execvp cmd args - with _ -> - sys_exit 127 - end - | id -> id -;; - -let waitpid = Unix.waitpid;; - -let wait_estatus status = match status with - | Unix.WEXITED i -> if i >= 128 then 128 else i; - | Unix.WSIGNALED i -> 128 + i; - | Unix.WSTOPPED i -> 128 + i; -;;