io.launcher: Fix two potential bugs.

1) If first (pipe) succeeds but second one fails, first pipe leaks.
2) out>> dispose fails, then in>> dispose is never called and leaks.
db4
Doug Coleman 2013-05-19 10:15:14 -07:00
parent c64cb2c886
commit 7c1caacc35
1 changed files with 3 additions and 3 deletions

View File

@ -233,15 +233,15 @@ PRIVATE>
: <process-stream*> ( desc encoding -- stream process ) : <process-stream*> ( desc encoding -- stream process )
[ [
[ [
(pipe) (pipe) { (pipe) |dispose
[ [ |dispose drop ] bi@ ] (pipe) |dispose {
[ [
rot >process rot >process
[ swap in>> or ] change-stdin [ swap in>> or ] change-stdin
[ swap out>> or ] change-stdout [ swap out>> or ] change-stdout
run-detached run-detached
] ]
[ [ out>> dispose ] [ in>> dispose ] bi* ] [ [ out>> &dispose drop ] [ in>> &dispose drop ] bi* ]
[ [ in>> <input-port> ] [ out>> <output-port> ] bi* ] [ [ in>> <input-port> ] [ out>> <output-port> ] bi* ]
} 2cleave } 2cleave
] dip <encoder-duplex> swap ] dip <encoder-duplex> swap