diff --git a/test/simple/test-http-curl-chunk-problem.js b/test/simple/test-http-curl-chunk-problem.js index 701624633594..8f682443069a 100644 --- a/test/simple/test-http-curl-chunk-problem.js +++ b/test/simple/test-http-curl-chunk-problem.js @@ -69,13 +69,16 @@ var server = http.createServer(function(req, res) { res.write(data); }); + cat.stdout.on('end', function onStdoutEnd() { + res.end(); + }); + // End the response on exit (and log errors) cat.on('exit', function(code) { if (code !== 0) { console.error('subprocess exited with code ' + code); process.exit(1); } - res.end(); }); });