| Index: runtime/bin/stdio_macos.cc
|
| diff --git a/runtime/bin/stdio_macos.cc b/runtime/bin/stdio_macos.cc
|
| index 24f0414a8f72fcc0dd754f2329b23fb99a18ee30..7dc11415f9acf3186e3ed32a4fb7b9305ddcd69b 100644
|
| --- a/runtime/bin/stdio_macos.cc
|
| +++ b/runtime/bin/stdio_macos.cc
|
| @@ -5,16 +5,15 @@
|
| #include "platform/globals.h"
|
| #if defined(TARGET_OS_MACOS)
|
|
|
| +#include "bin/stdio.h"
|
| +
|
| #include <errno.h> // NOLINT
|
| #include <sys/ioctl.h> // NOLINT
|
| #include <termios.h> // NOLINT
|
|
|
| -#include "bin/stdio.h"
|
| #include "bin/fdutils.h"
|
| -
|
| #include "platform/signal_blocker.h"
|
|
|
| -
|
| namespace dart {
|
| namespace bin {
|
|
|
| @@ -30,7 +29,7 @@ int Stdin::ReadByte() {
|
| bool Stdin::GetEchoMode() {
|
| struct termios term;
|
| tcgetattr(STDIN_FILENO, &term);
|
| - return (term.c_lflag & ECHO) != 0;
|
| + return ((term.c_lflag & ECHO) != 0);
|
| }
|
|
|
|
|
| @@ -38,9 +37,9 @@ void Stdin::SetEchoMode(bool enabled) {
|
| struct termios term;
|
| tcgetattr(STDIN_FILENO, &term);
|
| if (enabled) {
|
| - term.c_lflag |= ECHO|ECHONL;
|
| + term.c_lflag |= (ECHO | ECHONL);
|
| } else {
|
| - term.c_lflag &= ~(ECHO|ECHONL);
|
| + term.c_lflag &= ~(ECHO | ECHONL);
|
| }
|
| tcsetattr(STDIN_FILENO, TCSANOW, &term);
|
| }
|
| @@ -49,7 +48,7 @@ void Stdin::SetEchoMode(bool enabled) {
|
| bool Stdin::GetLineMode() {
|
| struct termios term;
|
| tcgetattr(STDIN_FILENO, &term);
|
| - return (term.c_lflag & ICANON) != 0;
|
| + return ((term.c_lflag & ICANON) != 0);
|
| }
|
|
|
|
|
| @@ -67,8 +66,8 @@ void Stdin::SetLineMode(bool enabled) {
|
|
|
| bool Stdout::GetTerminalSize(intptr_t fd, int size[2]) {
|
| struct winsize w;
|
| - if (NO_RETRY_EXPECTED(ioctl(fd, TIOCGWINSZ, &w) == 0) &&
|
| - (w.ws_col != 0 || w.ws_row != 0)) {
|
| + int status = NO_RETRY_EXPECTED(ioctl(fd, TIOCGWINSZ, &w));
|
| + if ((status == 0) && ((w.ws_col != 0) || (w.ws_row != 0))) {
|
| size[0] = w.ws_col;
|
| size[1] = w.ws_row;
|
| return true;
|
|
|