in src/com/pty4j/windows/conpty/WinConPtyProcess.java [100:126]
private void startAwaitingThread(@NotNull Command command) {
String commandLine = command.toCommandLine();
Thread t = new Thread(() -> {
int result = Kernel32.INSTANCE.WaitForSingleObject(processInformation.hProcess, INFINITE);
int exitCode = -100;
if (result == WinBase.WAIT_OBJECT_0) {
IntByReference exitCodeRef = new IntByReference();
if (!Kernel32.INSTANCE.GetExitCodeProcess(processInformation.hProcess, exitCodeRef)) {
LOG.info(LastErrorExceptionEx.getErrorMessage("GetExitCodeProcess(" + commandLine + ")"));
} else {
exitCode = exitCodeRef.getValue();
}
} else {
if (result == WinBase.WAIT_FAILED) {
LOG.info(LastErrorExceptionEx.getErrorMessage("WaitForSingleObject(" + commandLine + ")"));
} else {
LOG.info("WaitForSingleObject(" + commandLine + ") returned " + result);
}
}
myExitCodeInfo.setExitCode(exitCode);
myInputStream.awaitAvailableOutputIsRead();
cleanup();
}, "WinConPtyProcess WaitFor " + commandLine);
t.setDaemon(true);
t.start();
}