Thanks for the response and suggestion.
From eshell, 
     λ xdg-open file.txt  
exits immediately, without opening file.txt, and
     λ cat | xdg-open file.txt | cat
shows the same behavior, but
     λ setsid -w xdg-open file.txt
opens the file as expected.
Hope this helps,
Jeff



On Tue, Nov 22, 2022 at 12:20 PM Jim Porter <jporterbugs@gmail.com> wrote:
On 11/20/2022 9:14 PM, Jeff Kowalski wrote:
> While I cannot help to craft the solution (I'm limited by my knowledge
> of internals here), I'm very happy to help test proposals.  It seemed
> there was a hint of a solution developed in this thread.

This is a hacky workaround, but if it works for you, it would help prove
a strategy to fix this:

   ~ $ cat | xdg-open file.txt | cat

The above forces 'xdg-open' to be run with pipes for its stdin and
stdout. I believe the issue is that when 'xdg-open' sees a PTY for
stdin/stdout, it seems to assume that the PTY will live for a long time;
however, in Eshell, it will close the PTY as soon as 'xdg-open' returns,
which breaks things.

A real fix would be to tell Eshell that certain programs, like xdg-open,
should never use PTYs. (There used to be a variable called
'eshell-needs-pipe' that did something similar to this, but after
changing how Eshell connects processes, it was no longer needed.)