in JediTerm/src/main/kotlin/com/jediterm/app/JediTermMain.kt [49:78]
override fun createTtyConnector(): TtyConnector {
try {
val envs: Map<String, String> = configureEnvironmentVariables()
val command: Array<String> = if (isWindows()) {
arrayOf("powershell.exe")
}
else {
val shell = envs["SHELL"] ?: "/bin/bash"
if (isMacOS()) arrayOf(shell, "--login") else arrayOf(shell)
}
val workingDirectory = Path.of(".").toAbsolutePath().normalize().pathString
LOG.info("Starting ${command.joinToString()} in $workingDirectory")
val process = PtyProcessBuilder()
.setDirectory(workingDirectory)
.setInitialColumns(120)
.setInitialRows(20)
.setCommand(command)
.setEnvironment(envs)
.setConsole(false)
.setUseWinConPty(true)
.start()
return LoggingPtyProcessTtyConnector(process, StandardCharsets.UTF_8, command.toList())
}
catch (e: Exception) {
throw IllegalStateException(e)
}
}