Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@ryansg.com>2021-03-12 09:44:25 -0500
committerMike Gerwitz <mike.gerwitz@ryansg.com>2021-03-12 14:14:40 -0500
commit73255786246d24da2b618036f09203c9af7939a6 (patch)
treed9d4d30f88cfcd71066450425b9ff0149eb5056c /bin
parente7e4a61cf4e4609a735e5edf6ef8e5059152d63a (diff)
downloadtame-73255786246d24da2b618036f09203c9af7939a6.tar.gz
tame-73255786246d24da2b618036f09203c9af7939a6.tar.bz2
tame-73255786246d24da2b618036f09203c9af7939a6.zip
bin/tame{,d}: Fix assignments that lose exit code
Ensure that we fail if the command in the assignment fails.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tame5
-rwxr-xr-xbin/tamed8
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/tame b/bin/tame
index 44c54ce..47394b3 100755
--- a/bin/tame
+++ b/bin/tame
@@ -19,7 +19,8 @@
set -euo pipefail
-declare -r mypath=$( dirname "$( readlink -f "$0" )" )
+declare mypath; mypath=$( dirname "$( readlink -f "$0" )" )
+readonly mypath
declare -ri EX_NOTAMED=1 # tried to start tamed or runner but failed
declare -ri EX_STALLED=2 # runner stalled and could not recover
@@ -142,7 +143,7 @@ reserve-runner()
}
# grab the first available or request a new one
- local id=$( get-available-runner-id "$root" )
+ local id; id=$( get-available-runner-id "$root" )
if [ -z "$id" ]; then
id=$( spawn-runner-and-wait "$root" ) || {
echo "error: failed to reserve runner at $root" >&2
diff --git a/bin/tamed b/bin/tamed
index aff451f..04cf8c6 100755
--- a/bin/tamed
+++ b/bin/tamed
@@ -19,7 +19,8 @@
set -euo pipefail
-declare -r mypath=$( dirname "$( readlink -f "$0" )" )
+declare mypath; mypath=$( dirname "$( readlink -f "$0" )" )
+readonly mypath
declare -ri EX_RUNNING=1
declare -ri EX_USAGE=64 # incorrect usage; sysexits.h
@@ -145,9 +146,10 @@ stall-monitor()
# monitor output FIFO modification time
while true; do
- local -i since=$( date +%s )
+ local -i since last
+ since=$( date +%s )
sleep "$TAMED_STALL_SECONDS"
- local -i last=$( stat -c%Y "$base/1" )
+ last=$( stat -c%Y "$base/1" )
# keep waiting if there has been activity since $since
test "$last" -le "$since" || continue