mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
improve disconnection on testexec - it disconnects right after testing exec!
- it saves the result of tesetexec even tho disconnect clears it - moved the logic into sshhandler
This commit is contained in:
@@ -156,6 +156,14 @@ class SSHHandler: @unchecked Sendable, ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testExec() {
|
func testExec() {
|
||||||
|
defer {
|
||||||
|
Task { @MainActor in
|
||||||
|
let result = self.testSuceeded
|
||||||
|
await disconnect()
|
||||||
|
withAnimation { testSuceeded = result }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ssh_is_connected(session) == 0 {
|
if ssh_is_connected(session) == 0 {
|
||||||
withAnimation { testSuceeded = false }
|
withAnimation { testSuceeded = false }
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -99,13 +99,6 @@ struct ConnectionView: View {
|
|||||||
handler.go()
|
handler.go()
|
||||||
}
|
}
|
||||||
handler.testExec()
|
handler.testExec()
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now()+3) {
|
|
||||||
Task {
|
|
||||||
let result = handler.testSuceeded
|
|
||||||
await handler.disconnect()
|
|
||||||
handler.testSuceeded = result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} label: {
|
} label: {
|
||||||
if let testResult = handler.testSuceeded {
|
if let testResult = handler.testSuceeded {
|
||||||
Image(systemName: testResult ? "checkmark.circle" : "xmark.circle")
|
Image(systemName: testResult ? "checkmark.circle" : "xmark.circle")
|
||||||
|
|||||||
Reference in New Issue
Block a user