Skip to content

Conversation

@rosen-vladimirov
Copy link
Contributor

@rosen-vladimirov rosen-vladimirov commented May 4, 2017

stopApplication method calls killall command, which does not terminate the process immediately. So trying to restart the application, which is stopApplication followed by immediate startApplication call, fails with some strange error, that the app has started, but has exited since then. In order to fix this, add a timeout after stop is called, in order to ensure the app is dead. However in newer Xcode's there's a xcrun simctl terminate command, which really kills it.
So check the version of Xcode and in case it is 8 or later, use the new command instead of killall. In this scenario we do not have to add some magic timeout as the command works correctly.
However the xcrun simctl terminate command requires application identifier, while the killall command works with application name. So I've added another paramter to the stopApplication definition, which should be passed from CLI when calling this method - the applicationIdentifier will be used when Xcode 8 or later is installed, appName will be used for earlier versions.

stopApplication method calls killall command, which does not terminate the process immediately. So trying to restart the application, which is stopApplication followed by immediate startApplication call, fails with some strange error, that the app has started, but has exited since then. In order to fix this, add a timeout after stop is called, in order to ensure the app is dead. However in newer Xcode's there's a `xcrun simctl terminate` command, which really kills it.
So check the version of Xcode and in case it is 8 or later, use the new command instead of killall. In this scenario we do not have to add some magic timeout as the command works correctly.
However the xcrun simctl terminate command requires application identifier, while the killall command works with application name. So I've added another paramter to the stopApplication definition, which should be passed from CLI when calling this method - the applicationIdentifier will be used when Xcode 8 or later is installed, appName will be used for earlier versions.
@rosen-vladimirov rosen-vladimirov merged commit 2cdaa87 into master May 9, 2017
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/sleep branch May 9, 2017 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants