Skip to content

Commit c9553f2

Browse files
committed
feat(js): set exitCode = 1 on error
1 parent f1c11ea commit c9553f2

File tree

1 file changed

+15
-8
lines changed
  • packages/core/src/main/ts

1 file changed

+15
-8
lines changed

packages/core/src/main/ts/cli.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import {createRequire} from 'node:module'
44
import minimist from 'minimist'
55
import {buildstamp} from './buildstamp'
6+
import * as process from "node:process";
67

78
const camelize = (s: string) => s.replace(/-./g, x => x[1].toUpperCase())
89
const normalizeFlags = (flags = {}): Record<string, any> => Object.fromEntries(Object.entries(flags).map(([k, v]) =>
@@ -44,12 +45,18 @@ const { cwd, git, date, output, version, help, extra, safe } = normalizeFlags(mi
4445
return
4546
}
4647

47-
await buildstamp({
48-
cwd,
49-
date,
50-
git,
51-
output,
52-
safe,
53-
extra: extra ? JSON.parse(extra) : {}
54-
})
48+
try {
49+
await buildstamp({
50+
cwd,
51+
date,
52+
git,
53+
output,
54+
safe,
55+
extra: extra ? JSON.parse(extra) : {}
56+
})
57+
process.exit(0)
58+
} catch (e) {
59+
console.error(e)
60+
process.exit(1)
61+
}
5562
})()

0 commit comments

Comments
 (0)