PTY support

@fjakobs @lennartcl @mostafaeweda