diff options
Diffstat (limited to 'src/ChildProcess.purs')
-rw-r--r-- | src/ChildProcess.purs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ChildProcess.purs b/src/ChildProcess.purs index ad4e20f..34558fa 100644 --- a/src/ChildProcess.purs +++ b/src/ChildProcess.purs | |||
@@ -34,11 +34,17 @@ function spawnFn(command, args, errback, callback) { | |||
34 | }); | 34 | }); |
35 | 35 | ||
36 | process.on('close', function(code){ | 36 | process.on('close', function(code){ |
37 | var output = stdout.toString(); | 37 | var chalk = require('chalk'); |
38 | 38 | ||
39 | var error = output.length === 0 ? stderr.toString() : output + "\n" + stderr.toString(); | 39 | var output = stdout.toString('utf-8'); |
40 | 40 | ||
41 | if (code !== 0) errback(new Error(error))(); | 41 | var error = stderr.toString('utf-8'); |
42 | |||
43 | if (error.length > 0) { | ||
44 | console.error('\n' + chalk.red('*') + ' ' + error); | ||
45 | } | ||
46 | |||
47 | if (code !== 0) errback(new Error('Process terminated with code ' + code))(); | ||
42 | else callback(output)(); | 48 | else callback(output)(); |
43 | }); | 49 | }); |
44 | }; | 50 | }; |