Skip to content

Commit 03dc8cd

Browse files
committed
Propagate post-installation failures
pipefail might be ideal here but not sure how wide the support is yet considering this may run on plain sh.
1 parent 3e1c00e commit 03dc8cd

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

ci/build/npm-postinstall.sh

+15-4
Original file line numberDiff line numberDiff line change
@@ -113,29 +113,40 @@ install_with_yarn_or_npm() {
113113
# HACK: NPM's use of semver doesn't like resolving some peerDependencies that vscode (upstream) brings in the form of pre-releases.
114114
# The legacy behavior doesn't complain about pre-releases being used, falling back to that for now.
115115
# See https://github.com//pull/5071
116-
npm install --unsafe-perm --legacy-peer-deps --omit=dev
116+
if ! npm install --unsafe-perm --legacy-peer-deps --omit=dev; then
117+
return 1
118+
fi
117119
;;
118120
yarn*)
119-
yarn --production --frozen-lockfile --no-default-rc
121+
if ! yarn --production --frozen-lockfile --no-default-rc; then
122+
return 1
123+
fi
120124
;;
121125
*)
122126
echo "Could not determine which package manager is being used to install code-server"
123127
exit 1
124128
;;
125129
esac
130+
return 0
126131
}
127132

128133
vscode_install() {
129134
echo 'Installing Code dependencies...'
130135
cd lib/vscode
131-
install_with_yarn_or_npm
136+
if ! install_with_yarn_or_npm; then
137+
return 1
138+
fi
132139

133140
symlink_asar
134141
symlink_bin_script remote-cli code code-server
135142
symlink_bin_script helpers browser browser .sh
136143

137144
cd extensions
138-
install_with_yarn_or_npm
145+
if ! install_with_yarn_or_npm; then
146+
return 1
147+
fi
148+
149+
return 0
139150
}
140151

141152
main "$@"

0 commit comments

Comments
 (0)