#!/bin/sh
# Copyright 2010-2011, Iowa State University
# SPDX-License-Identifier: BSL-1.0

bindir=$(pwd)
cd @USERFILE_WORKING_DIRECTORY@
@USERFILE_ENV_COMMANDS@
if test "x$1" = "x--debugger"; then
	shift
	if test "x@LAUNCHERS_GOT_GDB@" = "xYES"; then
		echo "r @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@" > $bindir/gdbscript
		echo "bt" >> $bindir/gdbscript
		@GDB_COMMAND@ -batch -command=$bindir/gdbscript @LAUNCHERS_GDB_ARG@ @USERFILE_COMMAND@ 
	else
		"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@
	fi
else
	"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@
fi
