Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launching Mailpile's terminal hangs GUI-o-Mac-Tic #9

Open
BjarniRunar opened this issue Nov 14, 2018 · 4 comments
Open

Launching Mailpile's terminal hangs GUI-o-Mac-Tic #9

BjarniRunar opened this issue Nov 14, 2018 · 4 comments

Comments

@BjarniRunar
Copy link
Member

BjarniRunar commented Nov 14, 2018

So, this is a weird bug, but it is real; I've seen it many times and the behaviour is always the same. I am not sure whether to blame the MacOS Terminal, or GUI-o-Mac-Tic, but here's a description...

Steps to reproduce:

  1. Close all app windows, but leave Terminal running
  2. Log out, log back in
  3. The Terminal should be in a running state (according to the dock) but no windows open
  4. Launch the Mailpile app
  5. Select "open in Terminal" once the Status Window appears

The gui-o-mac-tic will now hang and nothing will happen. Hovering over the Status Window or the icon in the bar at the top will produce a spinning beach-ball.

Now, opening a new Terminal window using the Terminal's dock icon will cause two Terminals to open, one new and blank, the other containing the Mailpile CLI. The GUI becomes responsive again.

This only happens when I've just logged in, once I have un-stuck the GUI once, it doesn't seem to get stuck again, even if I Quit one or both of Mailpile and the Terminal.

Can you comment on this, @peturingi ? It's really weird.

Tested on MacOS High Sierra (10.13.3), using the 2018-11-13-2 dmg from here: https://www.mailpile.is/download/mac/ (warning: that DMG is broken in other ways, do not use for real mail)

@ghost
Copy link

ghost commented Nov 14, 2018

Implementing the terminal opening is non trivial due to its large statespace The number of state which is the terminal can be in at any one point. Will fix on saturday.

@BjarniRunar
Copy link
Member Author

Thanks!

@ghost
Copy link

ghost commented Nov 27, 2018

The good news is that I managed, harly, to figure out what is wrong.
The bad news is that I am still trying to figure out why what is wrong, is wrong.

The issue is due to gui-o-mac-tic's use of a possibly bad AppleScript. Namely in that gui-o-mac-tic uses this AppleScript to send commands to Terminal.app.

The issue can be reproduced with a pure AppleScript (without gui-o-mac-tic):

  1. Launch Terminal.app,
  2. close any Terminal.app windows (⌘w one or more times),
  3. log out your macOS User, leaving a mark in "Reopen Windows when logging back in" as shown in the following figure,

screenshot 2018-11-27 at 07 03 29

4. log in your macOS User, 5. launch /Application/Utilities/Script Editor.app, 6. execute the following script by placing it in the Script Editor, then run the script (keyboard shortcut ⌘r),
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions


if application "Terminal" is running then
	tell application "Terminal"
		do script "echo Hello World"
	end tell
end if

the Script Editor.app will "freeze" and hovering the cursor over it will animate a spinball. If at this point you click on the Terminal.app in the Dock then doing so will launch an empty Terminal Window, and a new window containing the "echo Hello World" which was executed by the AppleScript.

How to proceed towards a solution:
To solve the problem, one must find a way to execute the "echo Hello World" without freezing the Script Editor. That involves first figuring out why Script Editor does not freeze if the user has at any point had a Window open in Terminal.app (even if he has since then closed all of the windows), as long as that window was opened after the user has logged in.

@BjarniRunar
Copy link
Member Author

Thanks for looking into this and reporting back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant