Update start.js for pass code from start.sh (#45)

This commit is contained in:
Adam Dobrawy 2020-02-04 00:51:06 +01:00 committed by GitHub
parent 19caa5c351
commit fe38f0a751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -15,4 +15,4 @@ jobs:
uses: './'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
branch: '${{ github.ref }}'
branch: '${{ github.ref }}'

View File

@ -4,7 +4,14 @@ const path = require("path");
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 @@ const main = async () => {
main().catch(err => {
console.error(err);
console.error(err.stack);
process.exit(-1);
})
process.exit(err.code || -1);
})