Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why multios affects >/dev/tty redirection?



On Tue, 5 Feb 2019 at 17:43, Philippe Troin <phil@xxxxxxxx> wrote:
> 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.

I wonder if it's not fully on scrappy's side, i.e. that in such
situation there are no actual obstacles in providing a working
terminal-grasping app, which is rather proved by vim | cat working
just normally. I.e. if it's scrapy that does a ttty-test (i.e. calls
isatty()) and decides to provide a limited application. This is again
fully proven by the fact that this command:

vim > >(ansifilter > ansi.txt) > /dev/tty

Works as expected – i.e. vim outputs a warning about output being not
to a terminal, and then works without a single flaw, i.e. cursor-keys,
home, end keys also working fine.

So could Zshell answer positively to the isatty() call, if at least
one of the multios-outputs is a terminal? I think there's a big
meaning, sense in this, however I don't want the email to be verbose.

> > Is there a way around this?
>
> 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.

Interesting tool, however I cannot use it, because my client doesn't
want advanced, custom things, even a shell-scripts are questioned (the
project is in python).

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author