Tools: remove absolute paths in run_in_terminal_window

Also add quotes to avoid ambiguous redirect issue
This commit is contained in:
Peter Barker 2016-05-16 17:23:09 +10:00
parent 4116f80901
commit 27e7c870ed
1 changed files with 8 additions and 8 deletions

View File

@ -7,15 +7,15 @@ name="$1"
shift shift
echo "Starting $name : $*" echo "Starting $name : $*"
# default to xterm as it has the most consistent options and can start minimised # default to xterm as it has the most consistent options and can start minimised
if [ -n "$DISPLAY" -a -x /usr/bin/xterm ]; then if [ -n "$DISPLAY" -a -n "$(which xterm)" ]; then
/usr/bin/xterm -iconic -xrm 'XTerm*selectToClipboard: true' -xrm 'XTerm*initialFont: 6' -n "$name" -name "$name" -T "$name" -hold -e $* & xterm -iconic -xrm 'XTerm*selectToClipboard: true' -xrm 'XTerm*initialFont: 6' -n "$name" -name "$name" -T "$name" -hold -e $* &
elif [ -n "$DISPLAY" -a -x /usr/bin/konsole ]; then elif [ -n "$DISPLAY" -a -n "$(which konsole)" ]; then
/usr/bin/konsole --hold -e $* konsole --hold -e $*
elif [ -n "$DISPLAY" -a -x /usr/bin/gnome-terminal ]; then elif [ -n "$DISPLAY" -a -n "$(which gnome-terminal)" ]; then
/usr/bin/gnome-terminal -e "$*" gnome-terminal -e "$*"
elif [ -n "$STY" ]; then elif [ -n "$STY" ]; then
# We are running inside of screen, try to start it there # We are running inside of screen, try to start it there
/usr/bin/screen -X screen -t $name $* screen -X screen -t "$name" $*
else else
filename="/tmp/$name.log" filename="/tmp/$name.log"
echo "Window access not found, logging to $filename" echo "Window access not found, logging to $filename"
@ -24,6 +24,6 @@ else
# the following "true" is to avoid bash optimising the following call # the following "true" is to avoid bash optimising the following call
# to avoid creating a subshell. We need that subshell, or # to avoid creating a subshell. We need that subshell, or
# _fdm_input_step sees ArduPilot has no parent and kills ArduPilot! # _fdm_input_step sees ArduPilot has no parent and kills ArduPilot!
( : ; $cmd $* &>$filename < /dev/null ) & ( : ; $cmd $* &>"$filename" < /dev/null ) &
fi fi
exit 0 exit 0