Skip to content

Commit eb9e0a6

Browse files
committed
Merge remote-tracking branch 'origin/pr/642'
* origin/pr/642: Fix for #10797: qvm-open-in-vm should now work in KDE-based cubes Pull request description: `kde-open`/`kde-open5` start the process that handles the file in a way that the old `| cat` hack does not work. This fixes it. Tested on GNOME-, Xfce-, and KDE-based templates. Closes QubesOS/qubes-issues#10797
2 parents 0bd9464 + 394e973 commit eb9e0a6

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

qubes-rpc/qubes-open

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ fi
88
# gvfs-open, kde-open, and possibly others don't wait for editor to be
99
# closed, which is critical behaviour for DisposableVM (which gets destroyed
1010
# after this process exits).
11-
# The "| cat" is rather silly hack, to wait for all the children processes too
12-
# (unless they close their stdout). This is needed on Xfce template, because
13-
# exo-open starts the application in the background, but keeps the original
14-
# stdout/err connected.
11+
#
12+
# The `pidwait -A -f "$1"` is rather silly hack, to wait for the process that is
13+
# passed the temporary file path as a parameter, but ignoring parent processes.
14+
#
15+
# This is needed on Xfce template, because exo-open starts the application in
16+
# the background; and in templates built around KDE, because they start the
17+
# file handling process in a way that it is not a child of the shell that
18+
# spawned this script.
19+
#
20+
# We also want to make sure that `xdg-open`'s exit code is emitted back to
21+
# parent process in case of any errors.
1522
export DE=generic
16-
exec xdg-open "$@" | cat
23+
xdg-open "$@"
24+
XDG_OPEN_EXIT_CODE=$?
25+
pidwait -A -f "$1"
26+
exit $XDG_OPEN_EXIT_CODE

0 commit comments

Comments
 (0)