aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2019-04-18 22:07:19 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2019-04-18 23:15:27 -0400
commitc2eabdd49e82bf7e86be034939a73b1b13db614f (patch)
treebb200074d090a6d23fafdbf7cebacbfdc3caa6ef /libs
parent9d8a941c679faa2818e238f8869e13e43b99fe54 (diff)
downloadlibrebootfr-c2eabdd49e82bf7e86be034939a73b1b13db614f.tar.gz
librebootfr-c2eabdd49e82bf7e86be034939a73b1b13db614f.zip
libs/project: Avoid subshell in 'if' statements
The following will effectively disable any previous 'set -e': foo_fail() { ( set -e false true ) } if (set +e; foo_fail); then echo "foo_fail() failed, unsuccessfully" fi Creating a subshell within an 'if' statement makes 'set -e' non-functional.
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/project8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/project b/libs/project
index ea02293c..dfb745a0 100755
--- a/libs/project
+++ b/libs/project
@@ -149,7 +149,13 @@ project_action() {
printf '%s\n\n' "Project $project $action (with ${arguments:-no argument})"
- if (set +e; "$action" "$@"); then
+ (
+ set +e
+
+ "$action" "$@"
+ )
+
+ if [[ $? -eq 0 ]]; then
printf '\n%s\n' "Project $project $action (with ${arguments:-no argument}) completed"
else
printf 1>&2 '\n%s\n' "Project $project $action (with ${arguments:-no argument}) failed"