macos: keep remote control tunnel alive

This commit is contained in:
Peter Steinberger
2025-12-08 23:28:03 +01:00
parent 06f59f4e8a
commit 22259a322d
2 changed files with 11 additions and 2 deletions

View File

@@ -261,7 +261,14 @@ final class ControlChannel: ObservableObject {
let localPort = Self.pickAvailablePort()
let proc = Process()
proc.executableURL = URL(fileURLWithPath: "/usr/bin/ssh")
var args: [String] = ["-o", "BatchMode=yes", "-o", "ExitOnForwardFailure=yes", "-L", "\(localPort):127.0.0.1:18789", target]
var args: [String] = [
"-o", "BatchMode=yes",
"-o", "ExitOnForwardFailure=yes",
"-N", // don't run a remote shell; keep the tunnel open
"-T", // no pseudo-tty
"-L", "\(localPort):127.0.0.1:18789",
target,
]
if !identity.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
args.insert(contentsOf: ["-i", identity], at: 2)
}

View File

@@ -83,7 +83,9 @@ struct GeneralSettings: View {
.pickerStyle(.segmented)
.frame(width: 380, alignment: .leading)
self.healthRow
if self.state.connectionMode == .local {
self.healthRow
}
if self.state.connectionMode == .remote {
self.remoteCard