id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3679	proper forking of xdg-open	boruch		"The current script /usr/lib/mc/ext.d/doc.sh (and possibly others) invoke xdg-open without properly forking it. The result is that mc can not continue to be used until the spawned process is killed.

The current code (from https://www.midnight-commander.org/browser/misc/ext.d/doc.sh.in, line 190 is:

{{{
   (""${MC_XDG_OPEN}"" ""${MC_EXT_FILENAME}"" >/dev/null 2>&1) || \
}}}


This is an improvement over the version currently being distributed in debian stable (v4.8.13) in that it doesn't pollute the mc screen with xdg-open's stdout. However, while according to the dash man page, it does spawn and fork a sub-shell, it also waits until that sub-shell exits. The result is that mc switches to its internal shell (ie. the same a performing 'C-o'), and displays 'C-c' at the bottom of the screen. Attempting to 'C-o' back to the file-management window just echos back 'C-o'. Midnight Commander is effectively frozen in its shell window until the launched program exits, or until typing 'C-c' at the mc shell window.

An example of a correct way to fork (ie. what works for me) is:
{{{
   if ! ""${MC_XDG_OPEN}"" ""${MC_EXT_FILENAME}"" >/dev/null 2>&1 &
   then
     do_open_action ""${filetype}""
   fi
}}}
This was tested using the version currently being distributed in debian stable (v4.8.13), opening a libreoffice-writer document."	defect	new	minor	Future Releases	mc-core	master		xdg-open				no branch	
