Sujet : Faking a TTY on a pipe/socketpair De : Muttley (at) *nospam* dastardlyhq.com Groupes :comp.unix.programmer Date : 16. Nov 2024, 12:26:19 Autres entêtes Organisation : A noiseless patient Spider Message-ID :<vh9vgr$5bb$1@dont-email.me>
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.
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?
* The MacOS speech API is Objective-C only and completely obtuse.
** Yes I know about the master-slave ptm,pts approach and I have done that in the past but its complete overkill for this purpose.