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

xdg-open silently fails #21

Closed
lrkwz opened this issue Jan 20, 2018 · 8 comments
Closed

xdg-open silently fails #21

lrkwz opened this issue Jan 20, 2018 · 8 comments

Comments

@lrkwz
Copy link

lrkwz commented Jan 20, 2018

I'm using graphwiz though docker-compose-viz but when run to display on screen the command xdg-open silently fails.

Supposed you have a docker-compose.yml in the current dir the command line used is

docker pull pmsipilot/docker-compose-viz
docker run --rm \
    -it \
    -v $(pwd):/input/ \
    -u 0 \
    pmsipilot/docker-compose-viz \
    render --output-format display

My default image viewer is eog (gnome image viewer)

$ uname -a
Linux lrkwz-Precision-SSD-M4500 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.3 LTS
Release:	16.04
Codename:	xenial
$ gnome-shell --version
GNOME Shell 3.18.5
$ xdg-open --version
xdg-open 1.1.0 rc3
$ eog --version
GNOME Image Viewer 3.18.2

See pmsipilot/docker-compose-viz#27

@clue
Copy link
Member

clue commented Jan 20, 2018

Thank you for reporting!

Can you try running xdg-open image.svg manually and see if this reports any errors?

The current API used in this project is kind of awkward and will be reworked as per #14. Once this is in place, it should be far more reasonable to handle this situation and maybe throw an exception etc.

@lrkwz
Copy link
Author

lrkwz commented Jan 20, 2018

You are welcome:

$ xdg-open docker-compose.png
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "unity-gtk-module"

and the image shows up.

@clue
Copy link
Member

clue commented Jan 20, 2018

I'm not sure I follow, your original report suggests that this library does not open an image and does not report an error, right? Here's a gist of what this library does:

$ php -r 'exec("xdg-open docker-compose.png >/dev/null 2>/dev/null");'

@lrkwz
Copy link
Author

lrkwz commented Jan 22, 2018

Right.
But your gist works without errors.
So it must be something related to the file being opened (permissions? dockerd runs under root permissions)

@clue
Copy link
Member

clue commented Jan 22, 2018

Yeah, STDOUT/STDERR redirection isn't exactly helpful when debugging this issue :-) Can you try manually patching this line and see if this prints out any errors?

I'm not aware of any issues otherwise. I'm not familiar with your particular environment, but I suppose you're running this on your host and not within a Docker container?

@lrkwz
Copy link
Author

lrkwz commented Jan 22, 2018

We are catching it! Yes the command is run inside a docker container

docker run --rm \
    -it \
    -v $(pwd):/input/ \
    -u 0 \
    pmsipilot/docker-compose-viz \
    php -r 'exec("xdg-open docker-compose.png >/dev/null>/dev/null");'
sh: xdg-open: not found

@jubianchi can you fix the container?

@lrkwz lrkwz closed this as completed Jan 22, 2018
@clue
Copy link
Member

clue commented Jan 23, 2018

Happy to hear this helped pinpointing the issue!

For the reference: The upstream report mentions missing apk add xdg-utils

Despite this now being resolved, the error reporting will still eventually be improved via #14 :shipit:

@jubianchi
Copy link

jubianchi commented Jan 30, 2018

thanks @clue and @lrkwz for finding what the real issue was.

I’m going to add the missing xdg-open inthe container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants