mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 09:34:56 +08:00
Merge remote-tracking branch 'origin/GP-1399_Dan_noNullGdbExit' into Ghidra_10.1
This commit is contained in:
@@ -29,7 +29,7 @@ public interface PtySession {
|
|||||||
* @return the status code, if applicable and implemented
|
* @return the status code, if applicable and implemented
|
||||||
* @throws InterruptedException if the wait is interrupted
|
* @throws InterruptedException if the wait is interrupted
|
||||||
*/
|
*/
|
||||||
Integer waitExited() throws InterruptedException;
|
int waitExited() throws InterruptedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take the greatest efforts to terminate the session (leader and descendants)
|
* Take the greatest efforts to terminate the session (leader and descendants)
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ public class LocalProcessPtySession implements PtySession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer waitExited() throws InterruptedException {
|
public int waitExited() throws InterruptedException {
|
||||||
return process.waitFor();
|
return process.waitFor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class SshPtySession implements PtySession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer waitExited() throws InterruptedException {
|
public int waitExited() throws InterruptedException {
|
||||||
// Doesn't look like there's a clever way to wait. So do the spin sleep :(
|
// Doesn't look like there's a clever way to wait. So do the spin sleep :(
|
||||||
while (!channel.isEOF()) {
|
while (!channel.isEOF()) {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class LinuxPtyTest {
|
|||||||
PtySession bash =
|
PtySession bash =
|
||||||
pty.getChild().session(new String[] { DummyProc.which("bash") }, null);
|
pty.getChild().session(new String[] { DummyProc.which("bash") }, null);
|
||||||
pty.getParent().getOutputStream().write("exit\n".getBytes());
|
pty.getParent().getOutputStream().write("exit\n".getBytes());
|
||||||
assertEquals(0, bash.waitExited().intValue());
|
assertEquals(0, bash.waitExited());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public class LinuxPtyTest {
|
|||||||
* NOTE: Java subprocess dies with code 1 on unhandled exception. TODO: Is there a nice
|
* NOTE: Java subprocess dies with code 1 on unhandled exception. TODO: Is there a nice
|
||||||
* way to distinguish whether the code is from java or the execed image?
|
* way to distinguish whether the code is from java or the execed image?
|
||||||
*/
|
*/
|
||||||
assertEquals(1, dies.waitExited().intValue());
|
assertEquals(1, dies.waitExited());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ public class LinuxPtyTest {
|
|||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
assertEquals("Early exit with wrong code", expected,
|
assertEquals("Early exit with wrong code", expected,
|
||||||
session.waitExited().intValue());
|
session.waitExited());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException e) {
|
||||||
@@ -159,7 +159,7 @@ public class LinuxPtyTest {
|
|||||||
assertTrue("Not 'exit 3' or 'BASH:exit 3': '" + line + "'",
|
assertTrue("Not 'exit 3' or 'BASH:exit 3': '" + line + "'",
|
||||||
Set.of("BASH:exit 3", "exit 3").contains(line));
|
Set.of("BASH:exit 3", "exit 3").contains(line));
|
||||||
|
|
||||||
assertEquals(3, bash.waitExited().intValue());
|
assertEquals(3, bash.waitExited());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ public class LinuxPtyTest {
|
|||||||
writer.flush();
|
writer.flush();
|
||||||
assertTrue(Set.of("BASH:exit 3", "exit 3").contains(reader.readLine()));
|
assertTrue(Set.of("BASH:exit 3", "exit 3").contains(reader.readLine()));
|
||||||
|
|
||||||
assertEquals(3, bash.waitExited().intValue());
|
assertEquals(3, bash.waitExited());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class SshPtyTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
out.write("exit\n".getBytes("UTF-8"));
|
out.write("exit\n".getBytes("UTF-8"));
|
||||||
out.flush();
|
out.flush();
|
||||||
new StreamPumper(pty.getParent().getInputStream(), System.out).start();
|
new StreamPumper(pty.getParent().getInputStream(), System.out).start();
|
||||||
assertEquals(0, bash.waitExited().intValue());
|
assertEquals(0, bash.waitExited());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user