Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is this correct? Redirecting stdin/stout to implement a gdb-like "set inferior tty" in zshdb
- X-seq: zsh-users 13555
- From: "Rocky Bernstein" <rocky.bernstein@xxxxxxxxx>
- To: "Zsh users list" <zsh-users@xxxxxxxxxx>
- Subject: Re: Is this correct? Redirecting stdin/stout to implement a gdb-like "set inferior tty" in zshdb
- Date: Tue, 9 Dec 2008 11:19:04 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=CjwaiXcvcNV16rn1t/KTB8QjqcOYRDgx1Ncqrfft65I=; b=mKPaCgG0vyQE6HYQsD+cDYnKyziKT7hc60V1c1t8uS12WdtGhJFwPI+FRvIphloOHJ bOOKLp+fO20mNO/xi/lDCT9ERVpT+zLC/drZpXgORvUjkwfXfenmla4UcKUsWS8ctMw7 ADs5kowtY8o45JG2z2hJnaPMZUns38Q88EH/M=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=roYOy2O8z+bwmp7lyaq+wsS8fBchcm9VOMVY+m3XSy+dzCpjysZKnjCbdmRr2p4JQ3 UQqcHmxHr+HweNqaODjK4x/2h7tS2zM5Gg9y/H4ceJNB5plR9LW+vItneq0MlCk8t0MK +8VZKfs/Z3MFvnpSrBEHqJ58Ic9VEHIQ2Niu4=
- In-reply-to: <20081209121213.GA5462@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <6cd6de210812090327o11abb9f3w2cc932515e4dbef8@xxxxxxxxxxxxxx> <20081209121213.GA5462@xxxxxxxxxxxxxxx>
On Tue, Dec 9, 2008 at 7:12 AM, Stephane Chazelas
<Stephane_Chazelas@xxxxxxxx> wrote:
>
> On Tue, Dec 09, 2008 at 06:27:48AM -0500, Rocky Bernstein wrote:
> [...]
> > exec 7<&0 </dev/null 6>&1 # Line taken from an autoconf "configure" script.
> > #...
> > exec {_Dbg_fdi} <> $1
> > while : ; do
> > vared -e -h -p "foo> " line <&${_Dbg_fdi} || break
>
> The thing is read doesn't read from fd 0 (not does it write its
> prompt or the echoed and controlling characters to fd 0, 1 or 2)
> but from/to a fd that was open to the attached terminal upon
> start and some that's some fd over 10 so probably hard to
> redirect (if I use strace here, I see it reads and writes to fd
> 11).
[later corrected "read" to "vared"].
Here the thing though. The debugger sometimes *does* read from a file
(the debugger "source"
command).
So in light of a program that does both - sometimes read from a file
and sometimes from a terminal,
any suggestions?
>
>
> You may want to consider the "clone" feature:
>
> info --index-search=clone zsh
clone seems intriguing, although right now I'm not sure what other
problems I'll get into.
A simple test with another tty gave:
could not make /dev/pts/1 my controlling tty, job control disabled
Still for the case I was originally concerned with -- a
non-interactive script that becomes interactive -- it might work
better. Since the debugger wants to keep around a list of the input
and output file descriptors in use, would it make sense to use both
the exec <> and the clone? Or is there a way to capture the file
descriptor after the clone is done?
>
>
> > builtin print -- "$line" >&${_Dbg_fdi}
>
> ITYM
> print -r -- "$line"
(So happens in the real code I *do* want shell escapes expanded ;-)
>
>
> > line=''
> > done
> > echo "That's all folks! (${_Dbg_fdi})"
> >
> > Does zsh have <> like ksh does? It wasn't rejected, so I assume it does.
> [...]
>
> <> was Bourne already (though I beleive early versions had
> issues with it), so it should be recognised by every Bourne-like
> shell.
>
> --
> Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author