Yes the code is in transition as I learn more about Async, so take all
non essentials with a grain of salt.
I switched the wait function to:
let wait pi =
Unix.wait (`Pid (Core.Std.Pid.of_int pi.pid)) >>= function
| (_, Result.Ok ()) ->
Deferred.return (`Exited 0)
| (_, Result.Error (`Exit_non_zero n)) ->
Deferred.return (`Exited n)
| (_, _) ->
Deferred.return `Unknown
with no change in behaviour.
I do not get past the wait call and a ps shows the cat is still
running. This function works properly for a program that doesn't read
from stdin such as an ls, which is what leads me to think somehow
stdin is not getting closed properly.
Thanks for the quick response,
/M