mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
I encountered some trouble trying to use a virtio-console hooked up to a PTY. Reading from the PTY would produce stuff like this "\n\nsh-5.1# \n\nsh-5.1# " (where I'm just pressing enter at a shell prompt), and a terminal would render that like this: ---------------------------------------------------------------- sh-5.1# sh-5.1# ---------------------------------------------------------------- This was because we weren't disabling the ICRNL termios iflag, which turns carriage returns (\r) into line feeds (\n). Other raw mode implementations (like QEMU's) set this flag, and don't have this problem. Instead of fixing our raw mode implementation to just disable ICRNL, or copy the flags from QEMU's, though, here I've changed it to use the raw mode implementation in libc. It seems to work correctly in my testing, and means we don't have to worry about what exactly raw mode looks like under the hood any more. Signed-off-by: Alyssa Ross <hi@alyssa.is>