From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 4c3998b6 for ; Tue, 5 Feb 2019 16:42:35 +0000 (UTC) Received: (qmail 25490 invoked by alias); 5 Feb 2019 16:42:15 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23859 Received: (qmail 8031 invoked by uid 1010); 5 Feb 2019 16:42:15 -0000 X-Qmail-Scanner-Diagnostics: from granite.fifsource.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(173.255.216.206):SA:0(-1.9/5.0):. Processed in 1.6272 secs); 05 Feb 2019 16:42:15 -0000 X-Envelope-From: phil@fifi.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Message-ID: Subject: Re: Why multios affects >/dev/tty redirection? From: Philippe Troin To: zsh-users@zsh.org Date: Tue, 05 Feb 2019 08:35:48 -0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.4 (3.30.4-1.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit On Tue, 2019-02-05 at 02:28 +0100, Sebastian Gniazdowski wrote: > Hello, > I have a command: > > scrapy crawl 2nd "$@" "${optarray[@]}" 2> /tmp/reply 2> /dev/tty 1> > /tmp/reply 1> /dev/tty > > When invoked this way, scrapy (a python project) spawns an > interactive > console and it isn't fully usable – e.g.: cursor keys emit escape > sequencess rather t than moving the cursor or browsing history. That's because when you use multios, the stdout (and other multios descriptors) are not connected to a real terminal, but to a pipe connected to the invoking zsh process, zsh then sends the output to multiple files or devices. Because scrapy is not connected to a real terminal, it behaves differently. > However, when I invoke scrqpy in following way: > > scrapy crawl 2nd "$@" "${optarray[@]}" 2> /dev/tty 1> /dev/tty Here scappy is connected directly to the terminal, and everything works as expected. > Is there a way around this? Not without the help of another tool that can emulate a terminal. There was a very old tool called "pty" that could do that. I wrote a long time ago an enhanced version of that tool called ptyopen ( http://ftp.fifi.org/phil/ptyopen/ ) that does the same thing. You'd invoke it like: ptyopen scrapy crawl 2nd "$@" "${optarray[@]}" 2> /tmp/reply 2> /dev/tty 1> /tmp/reply 1> /dev/tty It then creates a pseudo-terminal, launches scrapy in it, and the pty output can then be used transparently with multios. Phil.