Update start.js for pass code from start.sh (#45)
This commit is contained in:
parent
19caa5c351
commit
fe38f0a751
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -15,4 +15,4 @@ jobs:
|
||||
uses: './'
|
||||
with:
|
||||
github_token: '${{ secrets.GITHUB_TOKEN }}'
|
||||
branch: '${{ github.ref }}'
|
||||
branch: '${{ github.ref }}'
|
||||
|
13
start.js
13
start.js
@ -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);
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user