Deutsch   English   Français   Italiano  
<vhca72$i0nn$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Muttley@DastartdlyHQ.org
Newsgroups: comp.unix.programmer
Subject: Re: Faking a TTY on a pipe/socketpair
Date: Sun, 17 Nov 2024 08:41:06 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <vhca72$i0nn$1@dont-email.me>
References: <vh9vgr$5bb$1@dont-email.me> <vhb0kg$ih4k$1@news.xmission.com>
Injection-Date: Sun, 17 Nov 2024 09:41:07 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2f53b61dbe86a085a792d4535f0fa63e";
	logging-data="590583"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18IyypxGdaTd+GUYH6o2GST"
Cancel-Lock: sha1:gmFkwjgUD9vLmGz8L/85Av2q3yI=
Bytes: 2605

On Sat, 16 Nov 2024 20:51:28 -0000 (UTC)
gazelle@shell.xmission.com (Kenny McCormack) boring babbled:
>In article <vh9vgr$5bb$1@dont-email.me>,  <Muttley@dastardlyhq.com> wrote:
>>So my question is - is there a way to set up a pipe or socketpair** so that
>>it appears to be a tty from the exec'd programs point of view, eg ttyname()
>>returns non null?
>
>I think the short answer to your question is: No.
>
>There's no way to directly do what you want in a clean way.
>
>Thus, all we have is kludgey workarounds.  And I'm sure you've got plenty
>of your own kludgey workarounds; you don't need any more from me.
>
>That said, if was me, I'd use Expect.  A few lines of Expect would do it,
>such that I could send text to the process and the process would think they
>were coming from a tty.  In fact, if you don't want to learn Expect (i.e.,
>Tcl) just for this project, I think just using "unbuffer -p" (unbuffer is a
>program that comes with the Expect distribution) would do it for you.

Hmm, both sound pretty kludgey too tbh. As for Tcl , thats a blast from the
past. Does anyone really still use it?

>Another way might be to write an interposer so that you could fool the
>"say" program into thinking it was talking to a tty even if it wasn't.  I
>haven't done any Mac programming in a long time (since my Mac stopped
>working), but I think interposers were do-able in the Mac ecosystem.

Not heard of that. Probably simpler just to do master-slave pty stuff in 
the end which I may well end up having to do.o

Kind of annoying the developers of "say" didn't consider this scenario. After
all , the whole point of having a command line speech utility is for it to
be controlled by another process, its not much use on its own other than
5 mins of novelty value!