Skip to content

Commit d7809ec

Browse files
authored
fix(scripts/coder-dev.sh): silence output if stdout is not a TTY (#16131)
The `make -j` output was sometimes emitting non-JSON output from `go generate`, resulting in errors like the below: ``` ++ /home/coder/src/coder/coder/scripts/coder-dev.sh organizations show me -o json ++ jq -r '.[] | select(.is_default) | .name' parse error: Invalid numeric literal at line 1, column 3 ``` This PR modifies `coder-dev.sh` to silence the output of `make` if the output is not a TTY.
1 parent 473fcc3 commit d7809ec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/coder-dev.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ case $BINARY_TYPE in
3939
coder-slim)
4040
# Ensure the coder slim binary is always up-to-date with local
4141
# changes, this simplifies usage of this script for development.
42-
make -j "${RELATIVE_BINARY_PATH}"
42+
# NOTE: we send all output of `make` to /dev/null so that we do not break
43+
# scripts that read the output of this command.
44+
if [[ -t 1 ]]; then
45+
make -j "${RELATIVE_BINARY_PATH}"
46+
else
47+
make -j "${RELATIVE_BINARY_PATH}" >/dev/null 2>&1
48+
fi
4349
;;
4450
coder)
4551
if [[ ! -x "${CODER_DEV_BIN}" ]]; then

0 commit comments

Comments
 (0)