Skip to content

Commit

Permalink
Update start.js for pass code from start.sh (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-m committed Feb 3, 2020
1 parent 19caa5c commit fe38f0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
uses: './'
with:
github_token: '${{ secrets.GITHUB_TOKEN }}'
branch: '${{ github.ref }}'
branch: '${{ github.ref }}'
13 changes: 10 additions & 3 deletions start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand All @@ -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);
})

0 comments on commit fe38f0a

Please sign in to comment.