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

Worked once then fails with low-level macOS error #44

Closed
Integralist opened this issue Mar 7, 2022 · 5 comments
Closed

Worked once then fails with low-level macOS error #44

Integralist opened this issue Mar 7, 2022 · 5 comments

Comments

@Integralist
Copy link

Integralist commented Mar 7, 2022

👋🏻

I installed this package, and ran it once and it worked fine. I then came back and tried it again (after making some code changes) and found that no matter what URL I provided to browser.OpenURL the function would error with...

NOTE: I've broken it up over multiple lines for readability.

The application cannot be opened for an unexpected reason, error=
  Error Domain=NSOSStatusErrorDomain 
  Code=-600 "procNotFound: no eligible process with specified descriptor" 
  UserInfo={_LSLine=379, _LSFunction=_LSAnnotateAndSendAppleEventWithOptions}

I've failed to find much useful information on this,
but there is a long thread from another project (which may or may not be useful):
lwouis/alt-tab-macos#704

@Integralist
Copy link
Author

Integralist commented Mar 7, 2022

Hmm. The plot thickens...

I just spent a few minutes committing all my code changes with the intention of restarting my laptop (as I'd seen someone say in the above thread URL that this helped them) and I thought I'd build my code one more time, where I then found it suddenly worked again and the URL I specified was opened in an existing open instance of my default browser.

Not sure what would have happened in that time frame for it to suddenly work again?

One thing I did do, but it didn't help, was I closed my browser and tried running my app again to see if opening the default browser afresh (rather than having the browser already open and the URL opening in a new tab) would work. It didn't work.

Then I wondered if it was because I had Ctrl-c my running go program, because when it started working again (i.e. the URL was opened in a new tab of an existing browser instance) I did a Ctrl-c and then re-ran the go app and again found the error was happening.

So I thought maybe it was because of the fact I've not handled signalling properly in the app and maybe the OS is not releasing some sort of file descriptor for my still open browser.

But then, after waiting a period of like (I dunno, at a guess 5 minutes) and trying to run my go app again (I've not done anything else btw at this point I got distracted googling for answers), it suddently started working again!? So it would appear that there's some sort of OS issue with releasing a resource (whatever that resource is) that's not happening immediately, but when it does the browser.OpenURL will succeed 🤔

Additionally, again with no code changes to my program, I was just hammering "up arrow, enter" to run my go program just while I was thinking in my head about the problem and then bang! all of sudden it worked and opened the browser!? But then for a different logic reason my program ended with a os.Exit(1) (rather than ending successfully) and so re-running the program brought me back to the original error again and the browser not opening 🤦🏻 .

@Integralist
Copy link
Author

And just to clarify, if I force my go app to end cleanly the problem still persists and on the next run of the app the browser will fail to open.

@Integralist
Copy link
Author

I have also tried https://github.com/toqueteos/webbrowser and found that it just reports:

webbrowser: can't open browser.

I've also tried https://github.com/skratchdot/open-golang with even less error context:

exit status 1

@Integralist
Copy link
Author

OK, this is replicable outside of the package, just by running open <any url>.

@Integralist
Copy link
Author

Going to close this now.

I discovered a new terminal instance worked fine every time, and so I then killed my tmux session/server and restarted it and found that my go program works fine every time now too.

Now sure what caused it to go so loopy, but that was frustrating 😬

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