Subject: Re: bug#44824: 27.1; Org export as pdf and open file does not open it

From: Eli Zaretskii <[email-masked]>
Date: Sun, 31 Jan 2021 17:05:37 +0200

> From: Maxim Nikulin <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> Date: Sun, 31 Jan 2021 18:15:27 +0700
> 
> Now I see that the problem with eshell is the same. I am not familiar 
> with eshell, but it creates new shell process for every executed 
> command. Actual handler is killed when underlying handler (kde-open5, 
> "gio open") and thus xdg-open and the main shell process exit.

What do you mean here by "actual handler" and "underlying handler"?

> Functions dealing with asynchronous processes in emacs, namely 
> (start-process ...) and its siblings for shell commands calls 
> (make-process :connection-type 'pty ...) that creates a pseudoterminal. 
> It is redundant for applications that do not require an interactive 
> terminal. When process (xdg-open this case) exits, pty is closed, all 
> processes from the same terminal group receives SIGHUP. So actual 
> handler is killed unless it has set signal handler or has detached from 
> terminal session.
> 
> To fix the problem it is better to use (make-process :connection-type 
> 'pipe ...) that unfortunately has no higher level wrappers.

Wouldn't it work to let-bind process-connection-type to nil around the
function that starts the async subprocess?

And I still don't understand why some people (like Lars) cannot
reproduce the problem at all -- the issue sounds like something that
should fail deterministically on any GNU/Linux system.  What am I
missing?