NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cannot disable output processing in pseudo-terminal (between openpty(3) parent and child)



On Sun, 30 Jul 2023, pouya+lists.netbsd%nohup.io@localhost wrote:

One of my use cases requires the child process to emit a binary
stream to be read by the parent.  The parent is notified first via
a specific escape sequence.  This almost works, except I can't
figure out how to disable output processing on this stream, and in
particular the parent receives extra CR characters for every LF
(NL) the child sends.


You'll have to turn off the NL -> CRNL output processing the kernel
does on your behalf (after all, this is still a "terminal" we're
talking about and not a simple pipe). Don't set the ONLCR bit in
the output-modes of the child pty.

Note that the shell you're running on the child-side also matters.
If that does any fancy line-editing using libedit or readline, say,
then that could change the ONLCR bit every time the shell has to
read input.

P.S. This other one's not as important but I'm also confused by
why disabling ECHO on the parent stdin also disables it for the
pseudo-terminal.


It shouldn't--unless you've unset that bit on the master then copied
those settings over onto the child pty FD.

-RVP


Home | Main Index | Thread Index | Old Index