
cd $UATDirectory
if [ -z "$uebp_LogFolder" ]; then
	LogDir="$HOME/Library/Logs/Unreal Engine/LocalBuildLogs"
else
	LogDir="$uebp_LogFolder"
fi

# if we are running under UE, we need to run this with the term handler (otherwise canceling a UAT job from the editor
# can leave dotnet, etc running in the background, which means we need the PID so we 
# run it in the background
if [ "$UE_DesktopUnrealProcess" = "1" ]; then
	# you can't set a dotted env var nicely in sh, but env will run a command with
	# a list of env vars set, including dotted ones
	echo Start UAT Non-Interactively: dotnet AutomationTool.dll "$@"
	trap TermHandler SIGTERM SIGINT
	env uebp_LogFolder="$LogDir" dotnet AutomationTool.dll "$@" &
	UATPid=$!
	wait $UATPid
else
	# you can't set a dotted env var nicely in sh, but env will run a command with
	# a list of env vars set, including dotted ones
	echo Start UAT Interactively: dotnet AutomationTool.dll "$@"
	which dotnet
	env uebp_LogFolder="$LogDir" dotnet AutomationTool.dll "$@"
fi

UATReturn=$?

# @todo: Copy log files to somewhere useful
# if not "%uebp_LogFolder%" == "" copy log*.txt %uebp_LogFolder%\UAT_*.*
# if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
#cp log*.txt /var/log

if [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
	exit $UATReturn
fi
_LogFolder="$LogDir" dotnet AutomationTool.dll "$@"
fi

UATReturn=$?

# @todo: Copy log files to somewhere useful
# if not "%uebp_LogFolder%" == "" copy log*.txt %uebp_LogFolder%\UAT_*.*
# if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
#cp log*.txt /var/log

if [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
	exit $UATReturn
fi
 [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
	exit $UATReturn
fi
g*.txt %uebp_LogFolder%\UAT_*.*
# if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
#cp log*.txt /var/log

if [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
	exit $UATReturn
fi
AT_*.*
#cp log*.txt /var/log

if [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
	exit $UATReturn
fi
dotnet AutomationTool.dll "$@"
fi

UATReturn=$?

# @todo: Copy log files to somewhere useful
# if not "%uebp_LogFolder%" == "" copy log*.txt %uebp_LogFolder%\UAT_*.*
# if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
#cp log*.txt /var/log

if [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run successfully. Exited with code: $UATReturn
	exit $UATReturn
fi
p_LogFolder" ]; then
	LogDir="$HOME/Library/Logs/Unreal Engine/LocalBuildLogs"
else
	LogDir="$uebp_LogFolder"
fi

# if we are running under UE, we need to run this with the term handler (otherwise canceling a UAT job from the editor
# can leave dotnet, etc running in the background, which means we need the PID so we 
# run it in the background
if [ "$UE_DesktopUnrealProcess" = "1" ]; then
	# you can't set a dotted env var nicely in sh, but env will run a command with
	# a list of env vars set, including dotted ones
	echo Start UAT Non-Interactively: dotnet AutomationTool.dll "$@"
	trap TermHandler SIGTERM SIGINT
	env uebp_LogFolder="$LogDir" dotnet AutomationTool.dll "$@" &
	UATPid=$!
	wait $UATPid
else
	# you can't set a dotted env var nicely in sh, but env will run a command with
	# a list of env vars set, including dotted ones
	echo Start UAT Interactively: dotnet AutomationTool.dll "$@"
	which dotnet
	env uebp_LogFolder="$LogDir" dotnet AutomationTool.dll "$@"
fi

UATReturn=$?

# @todo: Copy log files to somewhere useful
# if not "%uebp_LogFolder%" == "" copy log*.txt %uebp_LogFolder%\UAT_*.*
# if "%uebp_LogFolder%" == "" copy log*.txt c:\LocalBuildLogs\UAT_*.*
#cp log*.txt /var/log

if [ $UATReturn -ne 0 ]; then
	echo RunUAT ERROR: AutomationTool was unable to run ithDDC=true
