From 8faa197bca11152d89ff9fc9e3639460aae445ca Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Wed, 22 Jun 2016 14:16:47 +0200 Subject: [PATCH] Fixed spawn() resolving too early When the "exit" event is triggered, child process stdio streams might still be open and not flushed yet. This can lead to a loss of stdout/stderr data. --- src/beautifiers/beautifier.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beautifiers/beautifier.coffee b/src/beautifiers/beautifier.coffee index be01137..287a7f0 100644 --- a/src/beautifiers/beautifier.coffee +++ b/src/beautifiers/beautifier.coffee @@ -313,7 +313,7 @@ module.exports = class Beautifier # when the spawn child process exits, # check if there were any errors and # close the writeable stream - cmd.on('exit', (returnCode) => + cmd.on('close', (returnCode) => @debug('spawn done', returnCode, stderr, stdout) resolve({returnCode, stdout, stderr}) )