Skip to content

Commit

Permalink
Merge pull request #95 from stronk7/better_error_handling
Browse files Browse the repository at this point in the history
Better error handling, output stdout & stderr on problems
  • Loading branch information
andrewnicols authored May 24, 2024
2 parents 7880662 + 9c425a8 commit 33bbe63
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions prerelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,24 @@ generate_upgrade_notes() {

cd ${mydir}/gitmirror
if [ -f .grunt/upgradenotes.mjs ]; then
# We are going to use a temporal file to capture stdout and stderr, in case something fails.
tmpfile=$(mktemp) || \
{ output " ${R}Failed to create temp file.${N}"; exit 1; }
output " - Installing NodeJS modules"
nvm use --silent
npm ci --silent --no-progress > /dev/null 2>&1
# Capture output and error into a temporary file.
nvm use > "${tmpfile}" 2>&1 || \
output " ${R}Error running nvm. Details:${N} $(<"${tmpfile}")"
npm ci --no-progress > "${tmpfile}" 2>&1 || \
output " ${R}Error running npm ci. Details:${N} $(<"${tmpfile}")"
output " - Generating upgrade notes"
if [ $type == "major" ] || [ $type == "minor" ]; then
.grunt/upgradenotes.mjs release -d > /dev/null 2>&1
.grunt/upgradenotes.mjs release -d > "${tmpfile}" 2>&1 || \
output " ${R}Error running upgradenotes.mjs. Details:${N} $(<"${tmpfile}")"
else
.grunt/upgradenotes.mjs release > /dev/null 2>&1
.grunt/upgradenotes.mjs release > "${tmpfile}" 2>&1 || \
output " ${R}Error running upgradenotes.mjs. Details:${N} $(<"${tmpfile}")"
fi
rm -f "${tmpfile}"
else
output " ${Y}Upgrade notes script not found.${N}"
fi
Expand Down

0 comments on commit 33bbe63

Please sign in to comment.