mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +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:
parent
261b5f77a0
commit
8515efd6ee
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue