zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: How to obtain a simple use-case: redirect filtered data into file, unfiltered to the terminal?
Date: Thu, 7 Feb 2019 14:12:04 +0100	[thread overview]
Message-ID: <CAKc7PVBSJcVYT1WJDBx+63eazZdCbcjuUSQxz9Y91paJ=nGyeg@mail.gmail.com> (raw)

Hello,
I have a simple use-case that I would want to implement:
1. There is an application that outputs colorized logs.
2. I want the logs to go into a file (say `operation.log') filtered,
i.e. without colors.
3. But at the same time still go to the terminal unfiltered.
4. I want the application to have a positive response from the
iatty(1) function, i.e. that the application is thinking that the
output is to the terminal (well, it really *is*, it's just that it.
*also* goes to the file).

So writing one sentence: a terminal application outputting logs
filtered-and-redirected into a file, preserving the connection and
output to the terminal, i.e. isatty(1) answers positively for the app.

I tried with multios:

scrapy crawl 2nd_MyDom "$@" "${optarray[@]}" \
    > >(ansifilter >>! "scrapy.slog") 1> >/dev/tty

But this solution doesn't realize the 4th item – it doesn't provide
isatty(1) positive response for the app.

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

             reply	other threads:[~2019-02-07 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07 13:12 Sebastian Gniazdowski [this message]
2019-02-07 14:27 ` Eric Cook
2019-02-08  0:22 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKc7PVBSJcVYT1WJDBx+63eazZdCbcjuUSQxz9Y91paJ=nGyeg@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).