Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why multios affects >/dev/tty redirection?
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author