Deutsch English Français Italiano |
<vhdd8k$p4na$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 18:39:16 -0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Message-ID: <vhdd8k$p4na$1@dont-email.me> References: <vh9vgr$5bb$1@dont-email.me> <20241117093714.675@kylheku.com> Injection-Date: Sun, 17 Nov 2024 19:39:17 +0100 (CET) Injection-Info: dont-email.me; posting-host="2f53b61dbe86a085a792d4535f0fa63e"; logging-data="824042"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199lHsZDEvGvJPkyDHVg6qN" Cancel-Lock: sha1:XCC/+/15fhOiG8cG+BAHZHKbRMo= Bytes: 2039 On Sun, 17 Nov 2024 17:48:23 -0000 (UTC) Kaz Kylheku <643-408-1753@kylheku.com> boring babbled: >On 2024-11-16, Muttley@dastardlyhq.com <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? >[...] >> ** 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. > >No; you need a master/slave pseudo TTY pair connected to an active >process, which forwards between that and the socketpair or pipe. I figured as much but thought I'd ask, you never know. >Sockets and pipes cannot be given window dressing so that they look >like tty's. When the standard input (or output) of a process is a tty, >and that process cares about it, it will likely try operations like >tcgetattr. The only think I suspect this util cares about is whether its having a file redirected into its stdin and uses isatty() to find out. Its behaviour when injesting a file is to take it all in the speak the lot instead of line by line. Why I don't know, it would make little to no difference to the output.