GO: wait for application to quit using xdg-open

161 Views Asked by At

xdg-open does not wait for application to return and quits on exec. I have a script that creates a temporary file and opens it using xdg-open, and delete the tempfile once it's done for viewing. However, due to the design of xdg-open that does not "wait" despite running os.Exec(...).Run(), I get error message that the tmp file does not exists.

I tried using mimeopen and have a handler to get notified of file close (once). These didn't work perfectly.

How can I make sure my program only removes the tmp file after the actual viewer is done launching?

0

There are 0 best solutions below