Deutsch English Français Italiano |
<vheto8$15ghr$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: Mon, 18 Nov 2024 08:26:48 -0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Message-ID: <vheto8$15ghr$1@dont-email.me> References: <vh9vgr$5bb$1@dont-email.me> <vhe9aa$ufh7$1@dont-email.me> Injection-Date: Mon, 18 Nov 2024 09:26:49 +0100 (CET) Injection-Info: dont-email.me; posting-host="a13039780296c44b29e5aa9b4bf19c94"; logging-data="1229371"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19l6Pi2DdLyRX0bQRWErosw" Cancel-Lock: sha1:JcY+63G7G3eI0JeVIYFW1cPShJI= Bytes: 2331 On Mon, 18 Nov 2024 03:38:01 +0100 Janis Papanagnou <janis_papanagnou@hotmail.com> boring babbled: >On 16.11.24 12:26, Muttley@dastardlyhq.com wrote: >> There is a command line util (MacOS "say")* that I wish to use fork-exec'd >from >> my own program and send data to it via a socket created by socketpair(). >> Unfortunately "say" behaves differently depending on whether its stdin is >> attached to a tty or not (and there's no cmd line option to prevent this). >> With the former it'll speak after every newline, with the latter not until it > >> gets an EOF and I'd rather not do a fork-exec for each individual word or >> phrase that needs to be spoken. > >On shell level I'm using a program called 'pty' that takes the command >as argument to make it think it has a terminal connection. Say, instead >of calling (forking) your 'say' command you're calling (forking) the >'pty' command with your 'say' command provided as argument. And all the >gory details are kept inside the 'pty'. - I forgot whether 'pty' came >with my Linux system, or whether I downloaded it separately, or whether >I implemented or adapted the version that is published in Stevens' APUE >book (with the source code available online, IIRC). IME it's worthwhile >to have such a tool at hand; it's useful to me for various application >contexts, and the interface is clean, a separate small tool unnecessary >to be merged on source code level, and simple to use. Unfortunately I can't find an equivalent to the pty util on MacOS.