let discriminate_process_status s ret =
begin match ret with
| Lwt_unix.WEXITED 0 -> return ()
| Lwt_unix.WEXITED n -> fail (`Shell (s, `Exited n))
| Lwt_unix.WSIGNALED n -> fail (`Shell (s, `Signaled n))
| Lwt_unix.WSTOPPED n -> fail (`Shell (s, `Stopped n))
end