in src/com/pty4j/unix/UnixPtyProcess.java [62:92]
public UnixPtyProcess(@NotNull PtyProcessOptions options, boolean consoleMode) throws IOException {
myConsoleMode = consoleMode;
myPty = new Pty(consoleMode, options.isUnixOpenTtyToPreserveOutputAfterTermination());
myErrPty = options.isRedirectErrorStream() || !consoleMode ? null : new Pty();
String dir = Objects.requireNonNullElse(options.getDirectory(), ".");
ProcessBuilderUnixLauncher launcher = null;
if (Platform.isMac() && Platform.isIntel() && options.isSpawnProcessUsingJdkOnMacIntel()) {
try {
launcher = new ProcessBuilderUnixLauncher(
options.getCommandWrapper().toList(), options.getEnvironment(), dir,
myPty, myErrPty,
consoleMode,
options.getInitialColumns(), options.getInitialRows(), this
);
}
catch (Exception e) {
logger.info("Cannot use JDK launcher to run pty4j", e);
}
}
myLauncher = launcher;
if (myLauncher == null) {
execInPty(options.getCommandWrapper().toArray(), PtyUtil.toStringArray(options.getEnvironment()), dir, myPty, myErrPty,
options.getInitialColumns(), options.getInitialRows());
}
else {
launcher.getProcess().onExit().whenComplete((process, e) -> {
myPty.breakRead();
if (myErrPty != null) myErrPty.breakRead();
});
}
}