Open Bios-Marcel opened 4 years ago
So, the problem here seems to be an incorrect environment variable. The confusing thing however is, that xdg-open works when run via a terminal. However, my main problem isn't that it doesn't work, but that it doesn't return an error, even though xdg-open prints an error to stderr.
Yeah- this lib only returns an error if cmd.Start() or cmd.Run() return a non-zero exit code.
There is no parsing of stdout or stderr done.
I guess we could proxy other methods in Cmd (like Cmd.Output) so you could get stdout and stderr: https://golang.org/pkg/os/exec/#Cmd.Output
Maybe there's also a better way than calling xdg-open? Something where error handling is part of the API.
At one point I tried bundling the xdg-open code in this lib and calling it directly.
I see the following node lib checks if xdg-open is available, if it isn't, then it uses a version that is bundled: https://github.com/sindresorhus/open/blob/45e50caaae4af8f78588bdef017fce3ba818f8f6/index.js#L107-L116
I'm open to PRs, but we need a better way of confirming that changes work on all environments. I wonder if there's a way to use a github action to confirm that the code "works" in different environments/OSes?
At one point I tried bundling the xdg-open code in this lib and calling it directly.
I assume this could lead to problems on it's own.
Regarding testing, I assume we could register a custom handler for a file that sets some state on the harddrive, to check if the file was opened.
Hey,
I've been trying to open a simple JPEG. but I get no error and nothing happens.
xdg-open
is installed and I've tested to manually open the JPEG, which worked just fine. Any clue why this might happen?