refactor(ssh): use idiomatic property assignment and when-subject
Заменяет setInputStream(...) на присваивание channel.inputStream и вносит val в when-subject при установке сервера. Поведение не меняется.
This commit is contained in:
1 parent
3ce97763e2
commit
5faf1eb90e
2 files changed
+2
-3
No files matched your search
@@ -138,7 +138,7 @@ class SSHManager {
|
||||
// Нормализуем переносы строк stdin: Kotlin source может содержать
|
||||
// CRLF, что ломает bash heredoc/parser.
|
||||
val stdinLf = stdin.replace("\r\n", "\n").replace("\r", "\n")
|
||||
channel.setInputStream(ByteArrayInputStream(stdinLf.toByteArray(Charsets.UTF_8)))
|
||||
channel.inputStream = ByteArrayInputStream(stdinLf.toByteArray(Charsets.UTF_8))
|
||||
|
||||
val inStream = channel.inputStream
|
||||
channel.connect(execTimeoutMs)
|
||||
|
||||
@@ -143,8 +143,7 @@ class SshRepository(
|
||||
if (cfg.ip.isEmpty()) return InstallOutcome.Failed("no SSH config")
|
||||
_serverState.value = ServerState.Working("Установка free-turn-proxy...")
|
||||
|
||||
val result = runCmd(cfg, "Установка", ServerCommand.Install)
|
||||
return when (result) {
|
||||
return when (val result = runCmd(cfg, "Установка", ServerCommand.Install)) {
|
||||
is CmdResult.Err -> {
|
||||
_serverState.value = ServerState.Error(result.message)
|
||||
InstallOutcome.Failed(result.message)
|
||||
|
||||
Reference in new issue
Block a user