@@ -179,10 +179,15 @@ find_tool_bin() {
179179 done
180180
181181 if [[ -d /opt/hostedtoolcache ]]; then
182- find /opt/hostedtoolcache -maxdepth 6 -type f -name " ${name} " -perm -u+x 2> /dev/null |
183- head -n 1 |
184- xargs -r dirname
182+ local found
183+ found=" $( find /opt/hostedtoolcache -maxdepth 6 -type f -name " ${name} " -perm -u+x 2> /dev/null | head -n 1) "
184+ if [[ -n " ${found} " ]]; then
185+ dirname " ${found} "
186+ return 0
187+ fi
185188 fi
189+
190+ return 0
186191}
187192
188193ensure_bun () {
@@ -193,20 +198,13 @@ ensure_bun() {
193198 fi
194199
195200 local bin_dir
196- bin_dir=" $( find_tool_bin bun " ${HOME} /.bun/bin" ) "
197- if [[ -n " ${bin_dir} " ]]; then
201+ if bin_dir=" $( find_tool_bin bun " ${HOME} /.bun/bin" ) " && [[ -n " ${bin_dir} " ]]; then
198202 export PATH=" ${bin_dir} :${PATH} "
199203 return 0
200204 fi
201205
202- if ! command -v curl > /dev/null 2>&1 ; then
203- echo " Unable to find bun on PATH, and curl is unavailable to install it." >&2
204- return 1
205- fi
206-
207- curl -fsSL https://bun.sh/install | bash
208- export PATH=" ${HOME} /.bun/bin:${PATH} "
209- command -v bun > /dev/null 2>&1
206+ echo " Unable to find bun on PATH. The pr-testbox.yml warmup should install Bun; check the setup-bun step or the Testbox PATH." >&2
207+ return 1
210208}
211209
212210ensure_deno () {
@@ -217,20 +215,13 @@ ensure_deno() {
217215 fi
218216
219217 local bin_dir
220- bin_dir=" $( find_tool_bin deno " ${HOME} /.deno/bin" ) "
221- if [[ -n " ${bin_dir} " ]]; then
218+ if bin_dir=" $( find_tool_bin deno " ${HOME} /.deno/bin" ) " && [[ -n " ${bin_dir} " ]]; then
222219 export PATH=" ${bin_dir} :${PATH} "
223220 return 0
224221 fi
225222
226- if ! command -v curl > /dev/null 2>&1 ; then
227- echo " Unable to find deno on PATH, and curl is unavailable to install it." >&2
228- return 1
229- fi
230-
231- curl -fsSL https://deno.land/install.sh | sh
232- export PATH=" ${HOME} /.deno/bin:${PATH} "
233- command -v deno > /dev/null 2>&1
223+ echo " Unable to find deno on PATH. The pr-testbox.yml warmup should install Deno; check the setup-deno step or the Testbox PATH." >&2
224+ return 1
234225}
235226
236227with_node () {
0 commit comments