diff --git a/test/simple/test-debugger-client.js b/test/simple/test-debugger-client.js index fd18ec1579..6480e1c4d6 100644 --- a/test/simple/test-debugger-client.js +++ b/test/simple/test-debugger-client.js @@ -197,9 +197,14 @@ function doTest(cb, done) { connectCount++; console.log('ready!'); cb(c, function() { - console.error('>>> killing node process %d\n\n', nodeProcess.pid); - nodeProcess.kill(); - done(); + c.end(); + c.on('end', function() { + console.error( + '>>> killing node process %d\n\n', + nodeProcess.pid); + nodeProcess.kill(); + done(); + }); }); }); });