]> gitweb.factorcode.org Git - factor.git/commitdiff
io.launcher: Fix two potential bugs.
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 19 May 2013 17:15:14 +0000 (10:15 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 19 May 2013 17:18:14 +0000 (10:18 -0700)
1) If first (pipe) succeeds but second one fails, first pipe leaks.
2) out>> dispose fails, then in>> dispose is never called and leaks.

basis/io/launcher/launcher.factor

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