bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: procsub doesn't release the terminal without reading one byte


From: Martin D Kealey
Subject: Re: procsub doesn't release the terminal without reading one byte
Date: Sun, 13 Oct 2024 22:07:06 +1000

On Sun, 13 Oct 2024, 17:15 Oğuz, <oguzismailuysal@gmail.com> wrote:

> On Sun, Oct 13, 2024 at 3:18 AM Chet Ramey <chet.ramey@case.edu> wrote:
> > You have two processes fighting over stdin.
>
> Why though? Can't bash just close the procsub's stdin when `:' returns?
>

Of course not. The operating system won't let processes meddle with each
other's internals.

And even if you can, you shouldn't.

While there are exemptions for debuggers, they can't run without extra
metadata for the program in question (and preferably its source code).

In particular, there's no exemption for when one is a shell (like Bash) and
the other is a program it's launched.

On some operating systems there are extremely contrived ways to achieve
this, but then you face a far more fundamental problem: you can't tell
whether or not stdin has been replaced by the program itself, whereupon you
would wind up closing something that should be left alone.

-Martin


reply via email to

[Prev in Thread] Current Thread [Next in Thread]