mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
ad4e4ed92f
It's not only pointless, but causes issues when scripts are being run in another set -e container.
32 lines
967 B
Bash
Executable file
32 lines
967 B
Bash
Executable file
#!/bin/bash
|
|
set -eu
|
|
|
|
PROJECT="ArchiSteamFarm"
|
|
OUT="out/source"
|
|
|
|
cd "$(dirname "$(readlink -f "$0")")"
|
|
|
|
if [[ -z "${ASF_ARGS-}" ]]; then
|
|
ASF_ARGS=""
|
|
fi
|
|
|
|
ASF_ARGS+=" $*"
|
|
|
|
# Kill underlying ASF process on shell process exit
|
|
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM
|
|
|
|
if ! hash dotnet 2>/dev/null; then
|
|
echo "ERROR: dotnet CLI tools are not installed!"
|
|
exit 1
|
|
fi
|
|
|
|
dotnet --info
|
|
|
|
if grep -Eq '"Headless":\s+?true' "${PROJECT}/${OUT}/config/ASF.json"; then
|
|
# We're running ASF in headless mode so we don't need STDIN
|
|
dotnet exec "${PROJECT}/${OUT}/${PROJECT}.dll" $ASF_ARGS & # Start ASF in the background, trap will work properly due to non-blocking call
|
|
wait $! # This will forward dotnet error code, set -e will abort the script if it's non-zero
|
|
else
|
|
# We're running ASF in non-headless mode, so we need STDIN to be operative
|
|
dotnet exec "${PROJECT}/${OUT}/${PROJECT}.dll" $ASF_ARGS # Start ASF in the foreground, trap won't work until process exit
|
|
fi
|