Liste des Groupes | Revenir à cu programmer |
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'dfrommy 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 itgets 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.
Les messages affichés proviennent d'usenet.