mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 00:20:50 +00:00
Fix ASF not reacting to Docker SIGTERM
This one is tricky, trap code works properly but bash is not reacting to it when executing a binary. > If Bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. https://www.gnu.org/software/bash/manual/html_node/Signals.html
This commit is contained in:
@@ -6,14 +6,13 @@ if [[ -z "${ASF_ARGS-}" ]]; then
|
||||
ASF_ARGS=""
|
||||
fi
|
||||
|
||||
for ARG in "$@"; do
|
||||
ASF_ARGS+=" $ARG"
|
||||
done
|
||||
ASF_ARGS+=" $*"
|
||||
|
||||
# Kill underlying ASF process on shell process exit
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
|
||||
|
||||
while [[ -f ArchiSteamFarm.dll ]]; do
|
||||
dotnet ArchiSteamFarm.dll $ASF_ARGS # We will abort the script if ASF exits with an error
|
||||
dotnet ArchiSteamFarm.dll $ASF_ARGS &
|
||||
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
||||
sleep 1
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user