Implement most of the spec reusing scribe & nefthera code
This commit is contained in:
parent
e8b489dd6f
commit
612a98cfde
16 changed files with 225 additions and 25 deletions
11
ocaml/lib/system/process/fork.ml
Normal file
11
ocaml/lib/system/process/fork.ml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
open Qol
|
||||
|
||||
let run (command: string) (arguments: string list) =
|
||||
match Unix.fork () with
|
||||
| 0 -> Unix.execvp command (Array.of_list arguments)
|
||||
| pid -> let (_, status) = Unix.waitpid [] pid in
|
||||
match status with
|
||||
| Unix.WEXITED 0 -> ()
|
||||
| Unix.WEXITED n -> print ("Process exited with code " ^ str_int n)
|
||||
| Unix.WSIGNALED n -> print ("Process terminated by signal " ^ str_int n)
|
||||
| Unix.WSTOPPED n -> print ("Process stopped by signal " ^ str_int n)
|
||||
Loading…
Add table
Add a link
Reference in a new issue