3 ms·
One possibility is to carefully arrange file descriptors manually, so that fds 0 and 1/2 go to the socket. Check out dup2(2). But that's not probably what you
by oh5nxo 8y ago
One possibility is to carefully arrange file descriptors manually, so that fds 0 and 1/2 go to the socket. Check out dup2(2).
But that's not probably what you want, or sensible.
- kjeetgill 8y agoYea that's a no go. The rest of the process is doing stuff with those!
- int0x80 8y agoGNU readline gives the option to provide custom stdio streams. rl_{in,out}stream. You can use fdopen to get a stdio stream from a fd (socket for example). This can be problematic if not done correctly (buffering & stuff). Official documentation has more info on all this. You can also fork+dup2+pipe/pty and use stdin/out on the forked process.