How can one really create a process using Unix.create_process in OCaml?
ocaml, unix
Solution
The right way to call it is:
let pid = Unix.create_process "ls" [|"ls"|] Unix.stdin Unix.stdout Unix.stderr
The first element of the array must be the "command" name.
On some systems `/bin/ls` is a link to some bigger executable that will look at `argv.(0)` to know how to behave (c.f. Busybox); so you really need to provide that info.
(You see more often that with `/usr/bin/vi` which is now on many systems a sym-link to `vim`).
Problem
I have tried ``` let _ = Unix.create_process "ls" [||] Unix.stdin Unix.stdout Unix.stderr ``` in utop, it will crash the whole thing. If I write that into a `.ml` and compile and run, it will crash the terminal and my ubuntu will throw a system error. But why?