diff --git a/terminal/src/main/java/org/jline/terminal/impl/exec/ExecPty.java b/terminal/src/main/java/org/jline/terminal/impl/exec/ExecPty.java index eb5c1b48..7428f93e 100644 --- a/terminal/src/main/java/org/jline/terminal/impl/exec/ExecPty.java +++ b/terminal/src/main/java/org/jline/terminal/impl/exec/ExecPty.java @@ -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; + } + } } }