From 7eaeddb93cd344bfa2386a0eb620e92e3ec5c2c9 Mon Sep 17 00:00:00 2001 From: Julien Gilli Date: Thu, 26 Feb 2015 18:20:29 -0800 Subject: [PATCH] tests: fix race in test-http-curl-chunk-problem --- test/simple/test-http-curl-chunk-problem.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(); }); });