Byron / open-rs

Open a path or URL with the system-defined program
http://byron.github.io/open-rs
MIT License
314 stars 49 forks source link

`unix_wait_status(256)` on Mac OS Sonoma #96

Open ilyagr opened 5 months ago

ilyagr commented 5 months ago

Recently, open::that started failing often with the following error for me on Mac OS:

Launcher "/usr/bin/open" "http://127.0.0.1:17376" failed with ExitStatus(unix_wait_status(256))

Usually, it will work correctly on first invocation of the program that runs open::that, but fails afterwards.

The program starts a local server at http://127.0.0.1:17376 and then runs open::that("http://127.0.0.1:17376") inside tokio::task::spawn_blocking:

https://github.com/ilyagr/diffedit3/blob/54eecca2731a56478175c640564206b3a94d0344/src/local_server.rs#L171-L184

I don't know how to reliably reproduce this, unfortunately, but I wanted to post this just in case somebody has any advice.

I'm using Mac OS Sonoma 14.4.1:

$ uname -a
Darwin macaw.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024;
root:xnu-10063.101.17~1/RELEASE_ARM64_T6020 arm64 arm Darwin

My default browser is Firefox 124.0.2


Update: This can be reproduced more easily:

$ open http://example.com
The application cannot be opened for an unexpected reason,
error=Error Domain=NSOSStatusErrorDomain Code=-600
"procNotFound: no eligible process with specified descriptor"
UserInfo={_LSLine=376, _LSFunction=_LSAnnotateAndSendAppleEventWithOptions}

Strictly speaking, this seems like an issue in Mac OS interacting with Firefox issue rather than a library issue, but I'd still track it here since the library open uses the Mac OS open utility exclusively.

See also https://github.com/cli/cli/issues/2871

Byron commented 5 months ago

Thanks for letting me know! I noticed that rarely MacOS even in prior versions can get into a state where open (CLI application) doesn't manage to open anything anymore until the machine is rebooted.

ilyagr commented 5 months ago

I also posted a bug on Bugzilla about this. I have no idea whether anybody will look at it.

https://bugzilla.mozilla.org/show_bug.cgi?id=1891167