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
hs.task - Process returning stdout/stderr after the process returned an exit code will crash Hammerspoon #1963
Comments
From a very quick look at your config, I think you're not capturing the return value of |
I'll give that a try. Thanks. :) I am surprised it has never been an issue before. |
it can be quite hard to spot - usually the symptom is "hey this timer/task stopped working after a while". |
I'm going to close this issue, but please re-open it if it's not fixed. We also merged some code that should clear up the |
@cmsj I've tried keeping the process in a table at the module level (to prevent GC), but I am still getting crashes. Now it's happening a few times a day. I can say it's related to my code change though. Can we reopen?
|
Out of interest, do the crashes go away if you remove |
I'll give it a try. |
It did not help. The thing that works, is not using |
@j-martin - Are you able to post your current working code and the current crash report? |
I pushed the code just now: https://github.com/j-martin/dotfiles/blob/master/.hammerspoon/init.lua#L15 which calls https://github.com/j-martin/dotfiles/blob/master/.hammerspoon/schedule.lua#L74 I'll post the report next time it happens. :) |
Sorry for the delay, I kept clicking "Reopen" for the past few days:
|
EDIT: Moved step to reproduce to the issue description. |
Or else hammerspoon will crash. See Hammerspoon/hammerspoon#1963
I have upgraded to Mojave this weekend and HS seems to crash every so often now. It happened twice in the past few days.
Steps to reproduce
Create a bash script at
/tmp/test.sh
:Run the following code in the HS Console
Result
After 3s Hammerspoon should crash. My understanding is that HS is receiving stdout/err after the process initially returned 0 and crashes there.
Expected result
HS should not crash. As far as what to do with the stdout/stderr, it can be discarded or have some kind of orphan process logger or something (if anybody cares).
Workaround
As a workaround, piping the stderr/stdout to /dev/null seems to fix the issue.
As for why/how I get in a situation where the stdout is sent after the process returned: I use HS to evaluate elisp with emacsclient. In this case org-capture for note taking https://github.com/j-martin/dotfiles/blob/master/.hammerspoon/emacs.lua#L25 . If I cancel the capture "sessions" it output a message to stdout which crashes HS. In the case of emacsclient the --no-wait flag or absence of does not prevent HS from crashing. For my config it's now fixed here: j-martin/dotfiles@aaa2f73
Hope that helps.
Crash report
The text was updated successfully, but these errors were encountered: