Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: When is STTY ignored?
- X-seq: zsh-workers 41184
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: When is STTY ignored?
- Date: Tue, 30 May 2017 23:27:51 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=Uv9R0mSok4IdTJp3IRBi1UpAmVP6P+VEDa869hB28V8=; b=itUEsRJLql2xjysmBqRJ1ezQVdkodBVTFp9Rp3cWRFAIksb0QJO5vaD3h/GRrNB9Pb eu1uEvtofoJHJtLcZyZSfK1UunJlxyjWmvIUMPu+OHqiAYab6TrmtvJsv+XpL2u1QEtm qKKHqghFSWX4m/++Z19X2+6lck8qcH80/ckdQJVm/FjBLPPH2Iy1xPPI9kDlPmmjweeu uZ0ebpSLg60RnT4zP0nFaNNLTgFEAJsa0qnpD5pEJtY0tVV6JppaKfrHDWszM3y6JYap Emc9Ci5GUp+T11Yyo4AZOd/94uuHWjiJIe7RbdJokyUdgl8UrbA4062iwrrb5vS3VwkK ZkEw==
- In-reply-to: <20170530065302.GA6568@chaz.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20170529203625.GA7664@chaz.gmail.com> <170529170209.ZM30652@torch.brasslantern.com> <20170530065302.GA6568@chaz.gmail.com>
On May 30, 7:53am, Stephane Chazelas wrote:
}
} In:
}
} (STTY=-echo line; STTY=-echo line); line
}
} the "-echo" is only applied to the 2nd and 3rd "line"
} invocations (instead of 1st and 2nd).
So, this is a little odd.
The "stty" command is run only when isatty(0) and the process is the
group leader, i.e., the foreground job.
In the construct
(command1; command2)
the group leader is the subshell, so STTY is ignored for command1;
but then command2 is optimized to an "exec" so it assumes the group
leadership and "stty" is run. However, that exec means the subshell
is gone and there is never an opportunity to undo the setting change,
so it remains in effect after command2 exits, and that's why it
appears to have been applied to the 3rd command in your example.
This means we ought to treat having STTY in the environment as a
reason to skip the optimization. However, I'm not sure we look for
STTY early enough in the call chain to handle this. For example,
jobtab[thisjob].stty_in_env is only assigned after the decision is
made and the child has been forked.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author