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

webbrowser::open is non-blocking on macOS but blocking on linux #13

Closed
samuela opened this issue Mar 31, 2019 · 9 comments
Closed

webbrowser::open is non-blocking on macOS but blocking on linux #13

samuela opened this issue Mar 31, 2019 · 9 comments

Comments

@samuela
Copy link

samuela commented Mar 31, 2019

The title is pretty self-explanatory. I'm on macOS 10.14.2 and Ubuntu 18.10.

This is weird to me because $BROWSER is not set and xdg-open is also non-blocking. I'm not really sure why but in any case it would be nice to have consistent behavior across platforms.

@samuela
Copy link
Author

samuela commented Mar 31, 2019

Note: This only applies when I don't have Firefox already open. If I have a Firefox window open already, then it appears to be non-blocking again...

@amodm
Copy link
Owner

amodm commented Apr 1, 2019

Indeed, it seems to be the case. From the looks of it, in Linux, calling Command::output() blocks when its stdout/err is set to Stdio::pipe() instead of Stdio::inherit(). This is likely happening because the browser that was opened is still holding a reference to the pipe fd that must've been created. Don't know why this doesn't happen on macOS.

But if inherit were to be used, the point of return an Output is meaningless, as it won't be captured anyways. In hindsight, return ExitStatus was probably better, instead of Output.

For the time being, I think I'll keep API compatibility by returning Output, but internally switch to ExitStatus

@amodm amodm closed this as completed in 6bc0bfa Apr 1, 2019
@amodm
Copy link
Owner

amodm commented Apr 1, 2019

@samuela can you confirm this works?

@samuela
Copy link
Author

samuela commented Apr 2, 2019

@amodm Ok, so this kinda works AFAICT. I just upgraded to version 0.5.1. It still works the same way in macOS. It now works on the ubuntu VM (same version and setup as in the first comment). But it still seems to be blocking when SSHing (with X11 forwarding) into the ubuntu box from the macOS machine. Admittedly, I didn't test this case when reporting the issue initially so I'm not sure whether or not this is a regression.

@samuela
Copy link
Author

samuela commented Apr 2, 2019

@amodm Thanks for your great turnaround time btw!

@amodm
Copy link
Owner

amodm commented Apr 2, 2019

That's super weird. I just tested on Ubuntu 18.04 (server) and macOS (client, using XQuartz), , and seems to work exactly as it's supposed to locally. Ubuntu to Ubuntu works as well.

@amodm
Copy link
Owner

amodm commented Apr 2, 2019

Can you detail out the config you're trying?

@amodm
Copy link
Owner

amodm commented Apr 2, 2019

@samuela if you do find time to share the config that can help reproduce the SSH issue, let's track it in a separate issue.

@amodm
Copy link
Owner

amodm commented Feb 19, 2022

Documenting here that new consistent behaviour is now enforced. See Consistent Behaviour section for details.

Relevant commit: 614cacf

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

2 participants