aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--package.json1
-rw-r--r--src/ChildProcess.purs12
2 files changed, 10 insertions, 3 deletions
diff --git a/package.json b/package.json
index d4159a5..46a37ae 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
29 }, 29 },
30 "dependencies": { 30 "dependencies": {
31 "async": "^1.3.0", 31 "async": "^1.3.0",
32 "chalk": "^1.1.0",
32 "glob": "^5.0.3", 33 "glob": "^5.0.3",
33 "loader-utils": "^0.2.6" 34 "loader-utils": "^0.2.6"
34 } 35 }
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 };