From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18031 invoked by alias); 30 May 2017 06:53:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41182 Received: (qmail 10862 invoked from network); 30 May 2017 06:53:11 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f43.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.43):SA:0(0.5/5.0):. Processed in 1.041734 secs); 30 May 2017 06:53:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM, SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.82.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Q0GXEV3naZtw+zGHSCWIJrjDb+GO2BGPMvrUFSTF9xc=; b=PRr+k6E2PnDxya4Fw+T/mP284rbbEmVubw5BpMD0wT2yaQkZhJqDthEDg5n2sBMnY1 aTwFCmzOY90G/AGGUFKlayVz2CfXetdc1JTnT2jHhUIfp92U6Vzw4ss9K/XDsOa7RYQB rxTozAQsSU4KyYZEsuxq20SmijRnNxLKu6PftA5fTQiKMeffFCYjoQCw5GD5j1dp35Wn Ypc3hopdGLUX66Ah/xcKWdZCMbmBCSMSP1RvraYa28K/eLQsCPtwGQNWl1/l4AHddj9D ZWNcvErJivYZb3fAOs7graVlmceiDfli1E6j8vvu1850vn+2VYEzveUWIQo2T6LeHax/ w0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=Q0GXEV3naZtw+zGHSCWIJrjDb+GO2BGPMvrUFSTF9xc=; b=I0tnOBd7nENvOFs5V4ppeuFEynxAnHFquWATx7EhSfiV/M1c/sAv0OV3sImhE6plHb zjhYzdJDVeMe0qQfSawck9TAHHLwmkeh69xwUecsBgItHcio81Mt8Ct6qkN4y2/Y1hYP sAG/2iQ86FourYIjG9KXiTb/at9F+bEWzF8zyxwiJHohbhSZubHb9hyXGmO0AIYYa1IT qrkE47l5YAjIcHWojZvuzxzWfoOy70PdjBnNm/xJq2H4TT0hS6R/M6fLOZmvak5hAjAC 7PcvZa1xPjkoSGWB6RiccufpJcG/gJk5MVMV4x1Kaswx+Bir3QQZy292MWv+HfAa0J98 sGNA== X-Gm-Message-State: AODbwcAGWT0HyMO1TfoaUQZ0ZklbzHCNRvpa4BMOFeHAD9YPelLlHhtY 7plg9+oCMO8W7d2j X-Received: by 10.28.74.134 with SMTP id n6mr558185wmi.40.1496127184717; Mon, 29 May 2017 23:53:04 -0700 (PDT) Date: Tue, 30 May 2017 07:53:02 +0100 From: Stephane Chazelas To: Bart Schaefer Cc: Zsh hackers list Subject: Re: When is STTY ignored? Message-ID: <20170530065302.GA6568@chaz.gmail.com> Mail-Followup-To: Bart Schaefer , Zsh hackers list References: <20170529203625.GA7664@chaz.gmail.com> <170529170209.ZM30652@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <170529170209.ZM30652@torch.brasslantern.com> User-Agent: Mutt/1.5.24 (2015-08-30) 2017-05-29 17:02:09 -0700, Bart Schaefer: > On May 29, 9:36pm, Stephane Chazelas wrote: > } > } It's not very clear to me when one may use STTY. > > It applies only to external commands, not those executed within zsh > (functions, loops, other multiline constructs, builtins). > > If it's in the environment of a function et al., it'll apply to all > external commands run from within that construct. Thanks. That doesn't seem to be the whole story though. See the examples I gave "line" is an external command. "eval" and "command" are builtin commands. STTY=-echo line STTY=-echo command line f() line; STTY=-echo f Do work, but not STTY=-echo eval line About zsh -c, it looks like it "works" as long as there's only one command: zsh -c 'STTY=-echo line' works (well, it doesn't seem to restore the settings afterwards) but not zsh -c 'STTY=-echo line; exit' It seems it never works in scripts even if they contain a single command. With scripts source from interactive shells, they seem to "work" but don't restore the tty settings. See also: line | STTY=-echo wc -c STTY=-echo head -n1 /dev/tty < /dev/null which don't "work" (even if they called stty, stty would fail because stdin is not a terminal anyway, but that would still be worth documenting). 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). And the issue when several are stacked mentioned before: $ f() STTY=-onlcr line; STTY=-echo f; stty asd asd speed 38400 baud; line = 0; -brkint -imaxbel iutf8 -onlcr -echo not applied, -onlcr not restored. It would be worth documenting that it can only be used in interactive shells and only for the simplest case of one simple external command at the prompt, not in subshell, and without stdin redirection -- Stephane