From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3980 invoked by alias); 3 Jun 2016 16:30:52 -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: X-Seq: 21607 Received: (qmail 4711 invoked from network); 3 Jun 2016 16:30:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UJQlbkSGPdvt0dRZ1pC5Ry7o82BhIjYo6UST0CQoUNU=; b=i7N4S6s/MgSWibGS84QHg9psxQLvCWO7sgsRC1dpfzH/9yuJL5p1jUV4L45jpoEPtG yyb34iEAhwkhhL4Lov1FHOX9uEGuSauIM/G4Hv3OFvtCXj0/sHOujThWNJGNPMGd1Zbb DG+6cT7e8nnGMhc2Wes9jRK7LcM5bxTTR6aiSAkR8mkWUOCEDxJlNy7oovjDuoIkK6Vv a+Z6V4U5D2DBDJtCqFOhCrospIGwn2JkZtxtOu/6IalrJ02ZkRn7oIGi53mthzkz/uAw pzL9tciOAqmqiUHmdfhfz53pNEtzh1eTxNfiQJKqA8jtpaGY8GMKiWmaHkk36uFSGdBR oWtQ== X-Gm-Message-State: ALyK8tJ230B4oA6ww/agtPydpZgm4qWALIj2qPcJZkffP6xlIlQUrReo0t7Hduy9x/QyZA9SiGFmBQZYOybKDg== X-Received: by 10.140.19.5 with SMTP id 5mr3954682qgg.98.1464971448646; Fri, 03 Jun 2016 09:30:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <160601214528.ZM14311@torch.brasslantern.com> References: <160601214528.ZM14311@torch.brasslantern.com> From: Sebastian Gniazdowski Date: Fri, 3 Jun 2016 18:30:29 +0200 Message-ID: Subject: Re: Mark descriptor as terminal for the -t test To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On 2 June 2016 at 06:45, Bart Schaefer 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: http://www.andre-simon.de/doku/ansifilter/en/ansifilter.php 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. Best regards, Sebastian Gniazdowski