Commit 952c7d1 1 parent 31ab863 commit 952c7d1 Copy full SHA for 952c7d1
File tree 1 file changed +12
-1
lines changed
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) {
106
106
maxBuffer : 1 << 24 // 16mb
107
107
} ) ;
108
108
var out = [ ] ;
109
+ var ended = false ;
110
+ var closed = false ;
109
111
child . stdout . on ( "data" , function ( data ) {
110
112
out . push ( data ) ;
111
113
} ) ;
114
+ child . stdout . on ( "end" , function ( ) {
115
+ if ( closed ) finish ( ) ;
116
+ else ended = true ;
117
+ } ) ;
112
118
child . stderr . pipe ( process . stderr ) ;
113
119
child . on ( "close" , function ( code ) {
114
120
// clean up temporary files, no matter what
@@ -123,6 +129,11 @@ exports.main = function(args, callback) {
123
129
throw err ;
124
130
}
125
131
132
+ if ( ended ) finish ( ) ;
133
+ else closed = true ;
134
+ } ) ;
135
+
136
+ function finish ( ) {
126
137
var output = [ ] ;
127
138
if ( argv . global )
128
139
output . push (
@@ -149,7 +160,7 @@ exports.main = function(args, callback) {
149
160
return callback ( err ) ;
150
161
throw err ;
151
162
}
152
- } ) ;
163
+ }
153
164
}
154
165
155
166
return undefined ;
You can’t perform that action at this time.
0 commit comments