I have a Linux process developed by a third-party developer that communicates with the terminal. For debugging, I want to see the connection go forward.
You might think that cat will do the trick (to see one direction):
./third-party-app & cat /dev/tty
... but it is not. Rather, cat steal half of the data intended for the application, which is almost useless.
a third-party application is hard-coded to accept /dev/tty .
One of the ways I found spying on a connection is to rename the device /dev/tty , say /dev/real_tty , and create a named pipe named /dev/tty instead. Then do:
cat /dev/real_tty | tee /dev/tty &
... at least let me see the result of /dev/real_tty by copying the data from /dev/real_tty into the named pipe /dev/tty and stdout .
This kind of work, but it feels really dodgy and relies on the hype to replace the device. It also does not work in both directions because named pipes carry data in only one direction.
What is the right way to do this?
If anyone is interested, the TTY device is an RS-232 connection with a microcontroller. Information is not sensitive or not protected. All processes (application and spyware) can run as root.
linux terminal tty pty embedded-linux
jbarlow
source share