improved how the terminal is updated, now just async reads aytomatically and will js not do anything if nothing recieved

terminal also starts at the top and doesnt have th wierd scroll artifacting
This commit is contained in:
neon443 committed 2025-06-22 18:43:10 +01:00
1 parent b60e8f4eed
commit 9338b46760
3 files changed
+16 -8

No files matched your search

+6 -6
View File
@@ -311,21 +311,21 @@ class SSHHandler: ObservableObject {
// RunLoop.main.add(self.readTimer!, forMode: .common)
}
func readFromChannel() -> String {
guard ssh_channel_is_open(channel) != 0 else { return "" }
guard ssh_channel_is_eof(channel) == 0 else { return "" }
func readFromChannel() -> String? {
guard ssh_channel_is_open(channel) != 0 else { return nil }
guard ssh_channel_is_eof(channel) == 0 else { return nil }
var buffer: [CChar] = Array(repeating: 0, count: 256)
var buffer: [CChar] = Array(repeating: 0, count: 16)
let nbytes = ssh_channel_read_nonblocking(channel, &buffer, UInt32(buffer.count), 0)
guard nbytes > 0 else { return "" }
guard nbytes > 0 else { return nil }
write(1, buffer, Int(nbytes))
let data = Data(bytes: buffer, count: buffer.count)
if let string = String(data: data, encoding: .utf8) {
return string
}
return ""
return nil
}
private func logSshGetError() {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.