Skip to content

Commit

Permalink
Force to use FreeBSD stty on Mac (#706)
Browse files Browse the repository at this point in the history
  • Loading branch information
foooomio authored Oct 14, 2021
1 parent 397e728 commit 5eaf519
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
14 changes: 1 addition & 13 deletions terminal/src/main/java/org/jline/terminal/impl/ExecPty.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,7 @@ protected void doSetAttr(Attributes attr) throws IOException {
commands.add(1, OSUtils.STTY_F_OPTION);
commands.add(2, getName());
}
try {
exec(system, commands.toArray(new String[commands.size()]));
} catch (IOException e) {
// Handle partial failures with GNU stty, see #97
if (e.toString().contains("unable to perform all requested operations")) {
commands = getFlagsToSet(attr, getAttr());
if (!commands.isEmpty()) {
throw new IOException("Could not set the following flags: " + String.join(", ", commands), e);
}
} else {
throw e;
}
}
exec(system, commands.toArray(new String[commands.size()]));
}
}

Expand Down
5 changes: 2 additions & 3 deletions terminal/src/main/java/org/jline/utils/OSUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ public class OSUtils {
} else {
tty = "tty";
stty = "stty";
sttyfopt = "-F";
infocmp = "infocmp";
if (IS_OSX) {
stty = "/bin/stty";
sttyfopt = "-f";
}
else {
sttyfopt = "-F";
}
}
TTY_COMMAND = tty;
STTY_COMMAND = stty;
Expand Down

0 comments on commit 5eaf519

Please sign in to comment.