Skip to content

Commit fe38f0a

Browse files
authored
Update start.js for pass code from start.sh (ad-m#45)
1 parent 19caa5c commit fe38f0a

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
uses: './'
1616
with:
1717
github_token: '${{ secrets.GITHUB_TOKEN }}'
18-
branch: '${{ github.ref }}'
18+
branch: '${{ github.ref }}'

start.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ const path = require("path");
44
const exec = (cmd, args=[]) => new Promise((resolve, reject) => {
55
console.log(`Started: ${cmd} ${args.join(" ")}`)
66
const app = spawn(cmd, args, { stdio: 'inherit' });
7-
app.on('close', resolve);
7+
app.on('close', code => {
8+
if(code !== 0){
9+
err = new Error(`Invalid status code: ${code}`);
10+
err.code = code;
11+
return reject(err);
12+
};
13+
return resolve(code);
14+
});
815
app.on('error', reject);
916
});
1017

@@ -15,5 +22,5 @@ const main = async () => {
1522
main().catch(err => {
1623
console.error(err);
1724
console.error(err.stack);
18-
process.exit(-1);
19-
})
25+
process.exit(err.code || -1);
26+
})

0 commit comments

Comments
 (0)