Skip to content

Commit

Permalink
Fix ExecPty parsing on some Alpine linux (fixes #1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 15, 2024
1 parent cf0f723 commit 397b2ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static int doGetInt(String name, String cfg) throws IOException {
return Integer.parseInt(matcher.group(1));
}
}
throw new IOException("Unable to parse " + name);
return 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ public class ExecPtyTest {
+ "-echoctl -echoprt -echoke -flusho -pendin\n"
+ "opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop";

private final String alpineSample = "speed 38400 baud;stty: standard input\n" + " line = 0;\n"
+ "intr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;\n"
+ "eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;\n"
+ "werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;\n"
+ "-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts\n"
+ "-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff\n"
+ "-iuclc -ixany -imaxbel -iutf8\n"
+ "opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\n"
+ "isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt\n"
+ "echoctl echoke -flusho -extproc";

@Test
public void testParseSize() throws IOException {
assertEquals(new Size(244, 85), ExecPty.doGetSize(linuxSttySample));
Expand All @@ -121,6 +132,7 @@ public void testParseSize() throws IOException {
assertEquals(new Size(244, 85), ExecPty.doGetSize(netBsdSttySample));
assertEquals(new Size(244, 85), ExecPty.doGetSize(freeBsdSttySample));
assertEquals(new Size(244, 85), ExecPty.doGetSize(hpuxSttySample));
assertEquals(new Size(0, 0), ExecPty.doGetSize(alpineSample));
}

@Test
Expand Down

0 comments on commit 397b2ce

Please sign in to comment.