Pārlūkot izejas kodu

Distribution script: Propagate non-0 exit codes

Danilo Bargen 6 gadi atpakaļ
vecāks
revīzija
fa96bc6522
1 mainītis faili ar 9 papildinājumiem un 3 dzēšanām
  1. 9 3
      dist/build-package.js

+ 9 - 3
dist/build-package.js

@@ -4,12 +4,18 @@ var process = require('process');
 
 var args = process.argv.slice(2);
 
+function abortOnError(code) {
+    if (code !== 0) {
+        process.exit(code);
+    }
+}
+
 if (os.type() === 'Linux') {
-   spawn('bash', ['dist/package.sh'].concat(args), {stdio: 'inherit'});
+   spawn('bash', ['dist/package.sh'].concat(args), {stdio: 'inherit'}).on('exit', abortOnError);
 } else if (os.type() === 'Darwin') {
-   spawn('bash', ['dist/package.sh'].concat(args), {stdio: 'inherit'});
+   spawn('bash', ['dist/package.sh'].concat(args), {stdio: 'inherit'}).on('exit', abortOnError);
 } else if (os.type() === 'Windows_NT') {
-   spawn('powershell', ['dist/package.sh'].concat(args), {stdio: 'inherit'});
+   spawn('powershell', ['dist/package.sh'].concat(args), {stdio: 'inherit'}).on('exit', abortOnError);
 } else {
    throw new Error("Unsupported OS found: " + os.type());
 }