Skip to content

Commit

Permalink
Fix closing of non-existing apps (#11)
Browse files Browse the repository at this point in the history
* Fix closing of non-existing apps
  • Loading branch information
SimonTheLeg committed Oct 7, 2018
1 parent 4da94bd commit 1403745
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
environment:
TEST_RES_DIR: /tmp/test-results
ARTIFACTS_DIR: /tmp/artifacts
APP_VERSION: v0.4.1
APP_VERSION: v0.5.0
steps:
- checkout
- run:
Expand Down
12 changes: 8 additions & 4 deletions applescriptHandler.go
Expand Up @@ -31,10 +31,14 @@ end tell
func CloseApp(appName string, reschan chan string, errchan chan error) func() {
return func() {
script := fmt.Sprintf(`
tell application "%s"
quit
end tell
`, appName)
if exists application "%s" then
tell application "%s"
quit
end tell
else
error "could not close app '%s, because it cannot be found"
end if
`, appName, appName, appName)

err := executeAppleScript(script)

Expand Down

0 comments on commit 1403745

Please sign in to comment.