diff options
Diffstat (limited to 'eclass/virtualwl.eclass')
-rw-r--r-- | eclass/virtualwl.eclass | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/eclass/virtualwl.eclass b/eclass/virtualwl.eclass index 162f615..9146425 100644 --- a/eclass/virtualwl.eclass +++ b/eclass/virtualwl.eclass @@ -17,7 +17,7 @@ esac if [[ ! ${_VIRTUALWL_ECLASS} ]]; then _VIRTUALWL_ECLASS=1 -# @ECLASS-VARIABLE: VIRTUALWL_REQUIRED +# @ECLASS_VARIABLE: VIRTUALWL_REQUIRED # @PRE_INHERIT # @DESCRIPTION: # Variable specifying the dependency on wayland. @@ -28,7 +28,7 @@ _VIRTUALWL_ECLASS=1 # into "kde? ( )" and add kde into IUSE. : ${VIRTUALWL_REQUIRED:=test} -# @ECLASS-VARIABLE: VIRTUALWL_DEPEND +# @ECLASS_VARIABLE: VIRTUALWL_DEPEND # @OUTPUT_VARIABLE # @DESCRIPTION: # Standard dependencies string that is automatically added to BDEPEND @@ -56,16 +56,6 @@ esac # @DESCRIPTION: # Start a new wayland session and run commands in it. # -# IMPORTANT: This command is run nonfatal !!! -# -# This means we are checking for the return code and raise an exception if it -# isn't 0. So you need to make sure that all commands return a proper -# code and not just die. All eclass function used should support nonfatal -# calls properly. -# -# The rationale behind this is the tear down of the started wayland session. A -# straight die would leave a running session behind. -# # Example: # # @CODE @@ -99,17 +89,15 @@ virtwl() { # TODO: don't run addpredict in utility function. WLR_RENDERER=pixman doesn't work addpredict /dev/dri - coproc VIRTWL { WLR_BACKENDS=headless exec tinywl -s 'echo $WAYLAND_DISPLAY'; } + local VIRTWL VIRTWL_PID + coproc VIRTWL { WLR_BACKENDS=headless exec tinywl -s 'echo $WAYLAND_DISPLAY; read _; kill $PPID'; } local -x WAYLAND_DISPLAY read WAYLAND_DISPLAY <&${VIRTWL[0]} debug-print "${FUNCNAME}: $@" - nonfatal "$@" - retval=$? + "$@" [[ -n $VIRTWL_PID ]] || die "tinywl exited unexpectedly" - kill $VIRTWL_PID - - [[ $retval = 0 ]] || die "Failed to run '$@'" + exec {VIRTWL[0]}<&- {VIRTWL[1]}>&- } fi |