mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
autotest: support mac osx terminal launch
This commit is contained in:
parent
71c2f69a63
commit
4f0dad19ea
@ -7,7 +7,9 @@ name="$1"
|
||||
shift
|
||||
echo "Starting $name : $*"
|
||||
# default to xterm as it has the most consistent options and can start minimised
|
||||
if [ -n "$DISPLAY" -a -n "$(which xterm)" ]; then
|
||||
if [ -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 $* &
|
||||
elif [ -n "$DISPLAY" -a -n "$(which konsole)" ]; then
|
||||
konsole --hold -e $*
|
||||
|
@ -15,6 +15,10 @@ import getpass
|
||||
import time
|
||||
import signal
|
||||
|
||||
# List of open terminal windows for macosx
|
||||
windowID = []
|
||||
|
||||
|
||||
class CompatError(Exception):
|
||||
'''a custom exception class to hold state if we encounter the parse error we are looking for'''
|
||||
def __init__(self,error, opts, rargs):
|
||||
@ -131,6 +135,10 @@ def kill_tasks():
|
||||
'AntennaTracker.elf',
|
||||
]
|
||||
|
||||
# will only run to close terminal windows in macosx platform
|
||||
for window in windowID:
|
||||
cmd = "osascript -e \'tell application \"Terminal\" to close (window(get index of window id %s))\'" % window
|
||||
os.system(cmd)
|
||||
if under_cygwin():
|
||||
return kill_tasks_cygwin(victim_names)
|
||||
|
||||
@ -583,10 +591,17 @@ def run_cmd_blocking(what, cmd, quiet=False, **kw):
|
||||
|
||||
def run_in_terminal_window(autotest, name, cmd):
|
||||
'''execute the run_in_terminal_window.sh command for cmd'''
|
||||
global windowID
|
||||
runme = [os.path.join(autotest, "run_in_terminal_window.sh"), name]
|
||||
runme.extend(cmd)
|
||||
progress_cmd("Run " + name, runme)
|
||||
p = subprocess.Popen(runme) # bg this explicitly?!
|
||||
|
||||
# bg this explicitly?!
|
||||
out = subprocess.Popen(runme,stdout=subprocess.PIPE).communicate()[0]
|
||||
if sys.platform == 'darwin':
|
||||
import re
|
||||
p = re.compile('tab 1 of window id (.*)')
|
||||
windowID.append(p.findall(out)[0])
|
||||
|
||||
tracker_uarta = None # blemish
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user