Update start.js for pass code from start.sh (#45)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1abd4be..d4cedd3 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -15,4 +15,4 @@
uses: './'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
- branch: '${{ github.ref }}'
\ No newline at end of file
+ branch: '${{ github.ref }}'
diff --git a/start.js b/start.js
index 49addcd..0e10b40 100644
--- a/start.js
+++ b/start.js
@@ -4,7 +4,14 @@
const exec = (cmd, args=[]) => new Promise((resolve, reject) => {
console.log(`Started: ${cmd} ${args.join(" ")}`)
const app = spawn(cmd, args, { stdio: 'inherit' });
- app.on('close', resolve);
+ app.on('close', code => {
+ if(code !== 0){
+ err = new Error(`Invalid status code: ${code}`);
+ err.code = code;
+ return reject(err);
+ };
+ return resolve(code);
+ });
app.on('error', reject);
});
@@ -15,5 +22,5 @@
main().catch(err => {
console.error(err);
console.error(err.stack);
- process.exit(-1);
-})
\ No newline at end of file
+ process.exit(err.code || -1);
+})