-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
system unresponsive during script execution of Status Menu app #115
Comments
Hello there and thank you very much for the donation! The problem here is that the script is immediately run when the status item is pressed. The Platypus app then waits for the script to finish executing on the main thread, parses the output and presents the menu. If the script locks up or goes to sleep, the app just merrily waits for it to finish none the less, which locks up the interface. Now, this wouldn't normally affect the rest of the system UI but Apple implements Status Items in such a way that they are "part of the interface" and can therefore lock up the main system UI thread. There are two solutions I see to this: a) Add a hard timeout limit for script execution (a few seconds), after which the script process is killed and no menu shown (or maybe a timeout error message) b) It may be possible to try to update the menu asynchronously, i.e. launch the script, show the empty menu, parse output from script in background and then add menu items on the main thread as the script output is received and parsed. This is likely to be tricky to do in a reliable way. However, it's something worth looking into. Some Apple-provided SystemUIServer menus (e.g. Time Machine) do update their contents dynamically. The Status Menu output mode has always been a bit flaky due to the special nature of the Status Item API, but maybe there are ways around it. What kind of scripts are you running that take such a long time to execute? For long-running processes, Status Menu output mode is unlikely to be what you want. |
hello, thanks for the reply. I'm running scripts which do network requests to show status, some of which can take a bit of time. Status menu output is really what I'm after. Would it be possible to send a notification from a background thread to the main thread after the script exits, and then after it has received the notification the main thread would read the output of the script. In the meanwhile, the main thread could show "processing…" or something like this? |
I just threw together a test project which shows that this is definitely possible. This feature is now on the Platypus 5.3 roadmap. Would you like me to send you a new ScriptExec binary with this feature as soon as it's working reliably? It may be months before I release another version of Platypus. |
perfect! Sure, I would love to receive a new ScriptExec binary. |
What is the status on this? Is there a special way to write the script to make the menu bar responsive? |
I'm afraid you'll have to wait for Platypus 5.3. |
Did you make a newer version of Platypus. It seems we've been at Platypus 5.3 for several years already |
Can I add an exit button? |
Hi
during the execution of the script called by a Status Menu App, the system becomes unresponsive. User input in Terminal becomes impossible, one has to ssh into the box to kill the script.
Steps to reproduce:
sleep 10
The problem doesn't happen with other user interfaces.
This is using Platypus 5.2 1008, running on 10.12.6
hope this is something you could fix?
The text was updated successfully, but these errors were encountered: