Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fengzch-das
multibuild
Commits
98e0da58
"platforms/reference/vscode:/vscode.git/clone" did not exist on "fdc7cc0741b35ad82c361a47436bd42579d385a0"
Commit
98e0da58
authored
Nov 21, 2018
by
Ivan Pozdeev
Committed by
Matthew Brett
Dec 14, 2019
Browse files
Allow spaces in suppress() args
parent
e0049424
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
common_utils.sh
common_utils.sh
+4
-3
tests/test_common_utils.sh
tests/test_common_utils.sh
+2
-0
No files found.
common_utils.sh
View file @
98e0da58
...
@@ -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
"
}
}
...
...
tests/test_common_utils.sh
View file @
98e0da58
...
@@ -69,6 +69,8 @@ ORIG_OPTS=$-
...
@@ -69,6 +69,8 @@ ORIG_OPTS=$-
set
+ex
set
+ex
[
"
$(
suppress bad_cmd
)
"
==
"
$(
printf
"Running bad_cmd
\n
bad"
)
"
]
\
[
"
$(
suppress bad_cmd
)
"
==
"
$(
printf
"Running bad_cmd
\n
bad"
)
"
]
\
||
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"
]
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment