Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wait until all data is read from stdout

  • Loading branch information...
commit 0cc17b361d29ad2363925f252519a025e2579ccc 1 parent 25dfbb9
@fgnass authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 gateway.js
View
8 gateway.js
@@ -103,9 +103,10 @@ module.exports = function gateway(docroot, options) {
, statusCode
, reason
, exit
+ , end
function done() {
- if (exit === undefined) return
+ if (exit === undefined || !end) return
if (exit && !body) error(500, handler + ' exited with code ' + exit)
else res.end()
}
@@ -119,7 +120,10 @@ module.exports = function gateway(docroot, options) {
})
child.stdout
- .on('end', done)
+ .on('end', function() {
+ end = true
+ done()
+ })
.on('data', function(buf) {
if (body) return res.write(buf)
Please sign in to comment.
Something went wrong with that request. Please try again.