"platforms/reference/vscode:/vscode.git/clone" did not exist on "fdc7cc0741b35ad82c361a47436bd42579d385a0"
Commit 98e0da58 authored by Ivan Pozdeev's avatar Ivan Pozdeev Committed by Matthew Brett
Browse files

Allow spaces in suppress() args

parent e0049424
...@@ -117,13 +117,14 @@ function suppress { ...@@ -117,13 +117,14 @@ function suppress {
# Set -e stuff agonized over in # Set -e stuff agonized over in
# https://unix.stackexchange.com/questions/296526/set-e-in-a-subshell # https://unix.stackexchange.com/questions/296526/set-e-in-a-subshell
local tmp=$(mktemp tmp.XXXXXXXXX) || return local tmp=$(mktemp tmp.XXXXXXXXX) || return
local opts=$- local ERREXIT_SET OUT
echo "Running $@" echo "Running $@"
if [[ $- = *e* ]]; then ERREXIT_SET=true; fi
set +e set +e
( set_opts $opts ; $@ > "$tmp" 2>&1 ) ; ret=$? ( if [[ -n $ERREXIT_SET ]]; then set -e; fi; "$@" > "$tmp" 2>&1 ) ; ret=$?
[ "$ret" -eq 0 ] || cat "$tmp" [ "$ret" -eq 0 ] || cat "$tmp"
rm -f "$tmp" rm -f "$tmp"
set_opts $opts if [[ -n $ERREXIT_SET ]]; then set -e; fi
return "$ret" return "$ret"
} }
......
...@@ -69,6 +69,8 @@ ORIG_OPTS=$- ...@@ -69,6 +69,8 @@ ORIG_OPTS=$-
set +ex set +ex
[ "$(suppress bad_cmd)" == "$(printf "Running bad_cmd\nbad")" ] \ [ "$(suppress bad_cmd)" == "$(printf "Running bad_cmd\nbad")" ] \
|| ingest "suppress bad_cmd" || ingest "suppress bad_cmd"
suppress bash -c '! false' &>/dev/null \
|| ingest "suppress cmd with space"
[ "$(suppress good_cmd)" == "Running good_cmd" ] \ [ "$(suppress good_cmd)" == "Running good_cmd" ] \
|| ingest "suppress good_cmd" || ingest "suppress good_cmd"
[ "$(suppress bad_mid_cmd)" == "Running bad_mid_cmd" ] \ [ "$(suppress bad_mid_cmd)" == "Running bad_mid_cmd" ] \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment