Skip to content

Commit

Permalink
fix: throw on exec error, fix #67
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 8, 2025
1 parent b9f797f commit 52816cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function gitCommit(operation: Operation): Promise<Operation> {
if (!all)
args = args.concat(updatedFiles)

await x('git', ['commit', ...args])
await x('git', ['commit', ...args], { throwOnError: true })

return operation.update({ event: ProgressEvent.GitCommit, commitMessage })
}
Expand Down Expand Up @@ -69,7 +69,7 @@ export async function gitTag(operation: Operation): Promise<Operation> {
args.push('--sign')
}

await x('git', ['tag', ...args])
await x('git', ['tag', ...args], { throwOnError: true })

return operation.update({ event: ProgressEvent.GitTag, tagName })
}
Expand All @@ -82,11 +82,11 @@ export async function gitPush(operation: Operation): Promise<Operation> {
return operation

// Push the commit
await x('git', ['push'])
await x('git', ['push'], { throwOnError: true })

if (operation.options.tag) {
// Push the tag
await x('git', ['push', '--tags'])
await x('git', ['push', '--tags'], { throwOnError: true })
}

return operation.update({ event: ProgressEvent.GitPush })
Expand Down
1 change: 1 addition & 0 deletions src/version-bump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export async function versionBump(arg: (VersionBumpOptions) | string = {}): Prom
const [command, ...args] = tokenizeArgs(operation.options.execute)
console.log(symbols.info, 'Executing script', command, ...args)
await x(command, args, {
throwOnError: true,
nodeOptions: {
stdio: 'inherit',
cwd: operation.options.cwd,
Expand Down

0 comments on commit 52816cc

Please sign in to comment.