Skip to content

Commit

Permalink
Restore partial failure handling with stty, fixes #889
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 31, 2023
1 parent ecbc73a commit 47f1ec9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion terminal/src/main/java/org/jline/terminal/impl/exec/ExecPty.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ protected void doSetAttr(Attributes attr) throws IOException {
commands.add(1, OSUtils.STTY_F_OPTION);
commands.add(2, getName());
}
exec(systemStream != null, commands.toArray(new String[0]));
try {
exec(systemStream != null, commands.toArray(new String[0]));
} 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;
}
}
}
}

Expand Down

0 comments on commit 47f1ec9

Please sign in to comment.