I'm trying to bring up a terminal to interactively ask for a file, and open it using a GUI program:
foot /bin/sh -c 'file=
fzf
;(setsid xdg-open "$file" &)'
I'm using setsid
, because otherwise the terminal takes down the xdg-open
with it when it exits.
The command above, however, doesn't work: it still exits without showing anything on the screen. However, when I add a sleep
at the end, it *does* work:
foot /bin/sh -c 'file=fzf
;(setsid xdg-open "$file" &); sleep 0.0000000001'
The terminal exits, but the process started by xdg-open
remains running.
What is going on here? Is there a cleaner way such that I can avoid the sleep (because I assume the exact time to sleep depends on the system).
I tried using disown
, but this doesn't work at all (even with the sleep
).
Asked by Remko
(133 rep)
Oct 14, 2022, 07:47 PM
Last activity: Oct 14, 2022, 10:14 PM
Last activity: Oct 14, 2022, 10:14 PM