mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:57:35 +00:00
more: Read keystrokes from stdout instead of trying to re-open it
If we're running more on a TTY that we don't have filesystem access to, we can't rely on open(ttyname(STDOUT_FILENO)). Since all the stdio fd's are opened read/write anyway, we can just read from stdout, even if it feels a bit weird. :^)
This commit is contained in:
parent
1037a1d2ba
commit
8325662186
1 changed files with 1 additions and 5 deletions
|
@ -50,11 +50,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
key_fd = open(ttyname(1), O_RDONLY);
|
||||
if (key_fd < 0) {
|
||||
perror("open");
|
||||
return 1;
|
||||
}
|
||||
key_fd = STDOUT_FILENO;
|
||||
|
||||
struct winsize ws;
|
||||
ioctl(1, TIOCGWINSZ, &ws);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue