I launch Appium server on Mac with:
open -a Terminal -n; osascript -e 'tell app "Terminal"
do script "appium -p 5677 -bp 1234"
end tell'
(open new terminal, and start Appium, Appium will open new window, but PID is new terminal's PID.)
and when Appium need to re-open, I'm using the following three steps:
kill Appium(node):
killall node
(I think this step node don't exit correctly, will restore when next time call Appium.)
Tell terminal exit:
osascript -e 'tell app "Terminal"
do script "exit"
end tell'
Kill terminal(close terminal window):
kill XXXXX (<-PID of second terminal)
When I run Appium with:
open -a Terminal -n; osascript -e 'tell app "Terminal"
do script "appium -p 5677 -bp 1234"
end tell'
it launches 2 Appium windows (1 is new window, and 1 is restore by system).
How can I exit Appium(node) correctly for don't restore Appium window?
Thank you for help!
Let's clean your code up:
open -a Terminal -n; osascript -e 'tell app "Terminal"
do script "appium -p 5677 -bp 1234"
end tell'
can become:
Appium -p 5677 -bp 1234 &
killall node
might be better as:
pkill -i Appium
Tell terminal exit:
osascript -e 'tell app "Terminal"
do script "exit"
end tell'
should just be:
exit