Skip to content

Commit 1b6f9e5

Browse files
authored
fix: fix ERRPIPE in scripts/lib.sh (#3908)
1 parent 3264960 commit 1b6f9e5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/lib.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,11 @@ if [[ "${CODER_LIBSH_NO_CHECK_DEPENDENCIES:-}" != *t* ]]; then
152152
# old version of Make installed out of the box that doesn't support new
153153
# features like ONESHELL.
154154
#
155-
# Piping commands directly into `head -n1` may result in ERRPIPE errors, so
156-
# we capture the version output first before
157-
make_version_raw="$(make --version 2>/dev/null)"
158-
make_version="$(echo "$make_version_raw" | head -n1 | grep -oE '([[:digit:]]+\.){1,2}[[:digit:]]+')"
155+
# We have to disable pipefail temporarily to avoid ERRPIPE errors when
156+
# piping into `head -n1`.
157+
set +o pipefail
158+
make_version="$(make --version 2>/dev/null | head -n1 | grep -oE '([[:digit:]]+\.){1,2}[[:digit:]]+')"
159+
set -o pipefail
159160
if [[ ${make_version//.*/} -lt 4 ]]; then
160161
libsh_bad_dependencies=1
161162
log "ERROR: You need at least make 4.0 to run the scripts in the Coder repo."

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy