https://kelefat.com/posts/understanding-and-using-pty/