Closed TheButlah closed 3 years ago
From what I can see, the problem is that this crate is using Process::spawn
to run the program. On top of that stdout
for that program is set to Stdio::null()
. The whole combination leads to the situation when the exit status would be ok even if the xdg-open
script fails just because it was spawned successfully. This also leads to inability to run a text-mode browser under certain configurations, because it will have no tty to work with and will exit immediately.
To be completely correct it might be useful to change the script in such a way that it spawns GUI applications, runs CLI apps in foreground and exits if it is incapable of opening the provided path. And obviously use Process::output
instead of Process::spawn
. That's the rough idea.
This should now be fixed in the 0.5 release.
Hi, I came to this library when debugging why
cargo doc --open
doesn't actually open the web browser on Windows Subsystem for Linux 2 (WSL2). I've reproduced the issue by doing the following in this repository:cargo doc
cargo run <path_to_html>
Manually running the
xdg-open
bundled in this repo gives:It looks like it might be invoking the windows
start
command somehow. Unsure what mechanism makes this happen. The return code is 0, indicating a success, yet clearly the command failed.I am on WSL2, and running Ubuntu 20.04. I do not know if the problem also occurs on WSL1 or not. Note that the
BROWSER
environment variable is empty.The expected behavior would be to fail the command, since it does not complete successfully, or better yet, open the file in the windows web browser and translate the path.