Zsh Mailing List Archive
Messages sorted by:
Re: Mark descriptor as terminal for the -t test
- X-seq: zsh-users 21607
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Mark descriptor as terminal for the -t test
- Date: Fri, 3 Jun 2016 18:30:29 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UJQlbkSGPdvt0dRZ1pC5Ry7o82BhIjYo6UST0CQoUNU=; b=H/p7BUVSxoJczA58HC1dBU8z3wu6PRMCsFw7rJH3ap5NukE4qYzf8D1G2sIa7uTmbr wekl/H48K6rwAeub4XpgyuF2hL5Vqz+zXAeOBnQAf8MZInaJJ8eO7toJ1q2Rkfa++NJF 1E2l4YcUJkQVMRqDQEXLe3vUGdN047qJx1Ytp2kegcBQDLM7JAifMl/o/Mr2hViaMtqS TcxwpwjxibYgEslkzpfCvfFpHCOqGnolfVDJUZuwXFq4mQg20HmSaTpsklEU+YJYV92D EcJQyVL2XQMkKYQiDhBmIiGItEdljLZkAjpC4s4qvy/QOw56Dr7L6q/0yTe/G5yoFjfx sFkg==
- In-reply-to: <160601214528.ZM14311@torch.brasslantern.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVAvHk_DUx=Lid_vKBzFw9B3CSuDu7d8LmtzqV8AtgNcnA@mail.gmail.com> <160601214528.ZM14311@torch.brasslantern.com>
On 2 June 2016 at 06:45, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On May 13, 10:18am, Sebastian Gniazdowski wrote:
> } Subject: Mark descriptor as terminal for the -t test
> } Having a descriptor X, pointing to a file or to a process (with >(cmd)
> } redirection), is it possible to make it look like terminal? For the
> } test -t to pass?
> No. The "is a terminal" state is at the OS level; the descriptor must
> refer to a tty device file.
isatty() is a call that probably all programs use to test for the state
> } The goal is: make this more robust:
> } exec > >(tee -a ~/$$.out)
> } It works, catches output of commands, however e.g. from vim, message
> } about "output is not to a terminal" appears.
> Almost any interactive command will be confused or broken by that usage.
> This is the reason that e.g. the "script" command exists.
A robust program, the script. Recalls asciinema.
Turns out the commands are not so confused. Either they assume there
is no terminal, and strip terminal control codes from output, or
ignore the fact (e.g. vim) and work well.
> I presume this is related to your "ztrace" project. I fear you're doomed
> to failure with that one, except in a very simple cases.
Turned out the isatty() == 0 is a useful thing. If a program is
capable of stripping his output out of control codes, let it do it. If
not, then it's a problem in general. So I was striving for a more
problematic situation. Could implement use of following program:
to strip control codes, but have no motivation to do so. The dream of
"reuse output without mouse" is better to be implemented at terminal
level. Ctrl-Space to invoke sophisticated selection and completion
mechanism, to paste-in some part of what terminal has seen up to this
moment. iTerm2 folks did numerous of things in their v3 release, but
there is no reusing of output, no ztrace-like interface.
Messages sorted by: