File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -106,9 +106,15 @@ exports.main = function(args, callback) {
106106 maxBuffer : 1 << 24 // 16mb
107107 } ) ;
108108 var out = [ ] ;
109+ var ended = false ;
110+ var closed = false ;
109111 child . stdout . on ( "data" , function ( data ) {
110112 out . push ( data ) ;
111113 } ) ;
114+ child . stdout . on ( "end" , function ( ) {
115+ if ( closed ) finish ( ) ;
116+ else ended = true ;
117+ } ) ;
112118 child . stderr . pipe ( process . stderr ) ;
113119 child . on ( "close" , function ( code ) {
114120 // clean up temporary files, no matter what
@@ -123,6 +129,11 @@ exports.main = function(args, callback) {
123129 throw err ;
124130 }
125131
132+ if ( ended ) finish ( ) ;
133+ else closed = true ;
134+ } ) ;
135+
136+ function finish ( ) {
126137 var output = [ ] ;
127138 if ( argv . global )
128139 output . push (
@@ -149,7 +160,7 @@ exports.main = function(args, callback) {
149160 return callback ( err ) ;
150161 throw err ;
151162 }
152- } ) ;
163+ }
153164 }
154165
155166 return undefined ;
You can’t perform that action at this time.
0 commit comments