Fix process bug

This commit is contained in:
Neale Pickett 2010-12-15 17:26:43 -07:00
parent f7db0e10d0
commit f97281cc2b
1 changed files with 9 additions and 17 deletions

View File

@ -8,6 +8,7 @@ let spawn prog args =
Unix.close fd0_exit;
Unix.dup2 fd1_entr Unix.stdout;
Unix.dup2 fd1_entr Unix.stderr;
Unix.close fd1_entr;
Unix.close fd1_exit;
@ -53,8 +54,6 @@ let canned_handler d p fd event =
p.finished (String.sub p.stdout 0 p.stdout_pos)
end
| Dispatch.Output ->
begin
try
let len =
Unix.write fd p.stdin p.stdin_pos
((String.length p.stdin) - p.stdin_pos)
@ -64,10 +63,6 @@ let canned_handler d p fd event =
Unix.close fd;
Dispatch.delete d fd
end
with Unix.Unix_error _ ->
Unix.close fd;
Dispatch.delete d fd
end
| Dispatch.Exception ->
()
@ -100,9 +95,6 @@ let rec sigchld s =
with Unix.Unix_error (Unix.ECHILD, _, _) ->
()
let sigpipe s = ()
let _ =
Sys.set_signal Sys.sigchld (Sys.Signal_handle sigchld);
Sys.set_signal Sys.sigpipe (Sys.Signal_handle sigpipe)
Sys.set_signal Sys.sigchld (Sys.Signal_handle sigchld)