Skip to content

Commit 45f2649

Browse files
authored
fix release proposal failing when stderr has output (#5362)
1 parent f9b96af commit 45f2649

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

scripts/release/helpers/terminal.js

+8-22
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ let timer
2323
let current
2424

2525
// Output a command to the terminal and execute it.
26-
function run (cmd, treatStderrAsFailure = true) {
27-
capture(cmd, treatStderrAsFailure)
26+
function run (cmd) {
27+
capture(cmd)
2828
}
2929

3030
// Ask a question in terminal and return the response.
@@ -55,7 +55,7 @@ function checkpoint (question) {
5555
}
5656

5757
// Run a command and capture its output to return it to the caller.
58-
function capture (cmd, treatStderrAsFailure = true) {
58+
function capture (cmd) {
5959
if (flags.debug) {
6060
log(`${GRAY}> ${cmd}${RESET}`)
6161
}
@@ -76,25 +76,11 @@ function capture (cmd, treatStderrAsFailure = true) {
7676

7777
if (flags.debug) {
7878
log(stdout)
79-
if (stderr) {
80-
if (flags['no-abort-on-error']) {
81-
log(`${RED}${stderr}${RESET}`)
82-
} else {
83-
fatal(
84-
stderr,
85-
'Aborting due to error! Use --no-abort-on-error to ignore and continue.'
86-
)
87-
}
88-
}
89-
} else if (treatStderrAsFailure && stderr) {
90-
if (flags['no-abort-on-error']) {
91-
log(`${RED}${stderr}${RESET}`)
92-
} else {
93-
fatal(
94-
stderr,
95-
'Aborting due to error! Use --no-abort-on-error to ignore and continue.'
96-
)
97-
}
79+
log(`${RED}${stderr}${RESET}`)
80+
}
81+
82+
if (result.status) {
83+
throw new Error(stderr)
9884
}
9985

10086
return stdout

scripts/release/proposal.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ try {
8282

8383
try {
8484
// Pull latest changes in case the release was started by someone else.
85-
run(`git remote show origin | grep v${newVersion} && git pull --ff-only`, false)
85+
run(`git remote show origin | grep v${newVersion} && git pull --ff-only`)
8686
} catch (e) {
8787
// Either there is no remote to pull from or the local and remote branches
8888
// have diverged. In both cases we ignore the error and will just use our
@@ -113,7 +113,7 @@ try {
113113

114114
// Cherry pick all new commits to the proposal branch.
115115
try {
116-
run(`echo "${proposalDiff}" | xargs git cherry-pick`, false)
116+
run(`echo "${proposalDiff}" | xargs git cherry-pick`)
117117

118118
pass()
119119
} catch (err) {
@@ -147,7 +147,7 @@ try {
147147

148148
// Create or edit the PR. This will also automatically output a link to the PR.
149149
try {
150-
run(`gh pr create -d -B v${releaseLine}.x -t "v${newVersion} proposal" -F ${notesFile}`, false)
150+
run(`gh pr create -d -B v${releaseLine}.x -t "v${newVersion} proposal" -F ${notesFile}`)
151151
} catch (e) {
152152
// PR already exists so update instead.
153153
// TODO: Keep existing non-release-notes PR description if there is one.

0 commit comments

Comments
 (0)