diff --git a/Tools/autotest/run_in_terminal_window.sh b/Tools/autotest/run_in_terminal_window.sh index 1d7a008aed..25816ed6f1 100755 --- a/Tools/autotest/run_in_terminal_window.sh +++ b/Tools/autotest/run_in_terminal_window.sh @@ -6,8 +6,25 @@ name="$1" shift echo "RiTW: Starting $name : $*" -# default to xterm as it has the most consistent options and can start minimised -if [ -n "$DISPLAY" -a -n "$(which osascript)" ]; then + +if [ -n "$SITL_RITW_TERMINAL" ]; then + # create a small shell script containing the command to run; this + # avoids problems where "screen" expects arguments in + # argv[1],argv[2],argv[3] where gnome-terminal expects the command + # to run be in argv[n+1] where argv[n] is "-e" + # this should work with: + # export SITL_RITW_TERMINAL="screen -D -m" + # export SITL_RITW_TERMINAL="gnome-terminal -e" + # export SITL_RITW_TERMINAL="konsole -e" + + test -z "$TMPDIR" && TMPDIR="/tmp/" + FILENAME="ritw-`date '+%Y%m%d%H%M%S'`" + FILEPATH="$TMPDIR/$FILENAME" + echo "#!/bin/sh" >"$FILEPATH" + echo "$*" >>"$FILEPATH" + chmod +x "$FILEPATH" + $SITL_RITW_TERMINAL "$FILEPATH" & +elif [ -n "$DISPLAY" -a -n "$(which osascript)" ]; then osascript -e 'tell application "Terminal" to do script "'"$* "'"' elif [ -n "$DISPLAY" -a -n "$(which xterm)" ]; then xterm -iconic -xrm 'XTerm*selectToClipboard: true' -xrm 'XTerm*initialFont: 6' -n "$name" -name "$name" -T "$name" -hold -e $* &