Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Sources/GhosttyTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1634,9 +1634,9 @@ class GhosttyApp {
let timestamp = ISO8601DateFormatter().string(from: Date())
let line = "[\(timestamp)] \(message)\n"
if let handle = FileHandle(forWritingAtPath: initLogPath) {
handle.seekToEndOfFile()
handle.write(Data(line.utf8))
handle.closeFile()
defer { try? handle.close() }
guard (try? handle.seekToEnd()) != nil else { return }
try? handle.write(contentsOf: Data(line.utf8))
} else {
FileManager.default.createFile(atPath: initLogPath, contents: line.data(using: .utf8))
}
Expand Down Expand Up @@ -3472,7 +3472,7 @@ class GhosttyApp {
}
if let handle = try? FileHandle(forWritingTo: backgroundLogURL) {
defer { try? handle.close() }
try? handle.seekToEnd()
guard (try? handle.seekToEnd()) != nil else { return }
try? handle.write(contentsOf: data)
}
}
Expand Down Expand Up @@ -4141,9 +4141,9 @@ final class TerminalSurface: Identifiable, ObservableObject {
let timestamp = ISO8601DateFormatter().string(from: Date())
let line = "[\(timestamp)] \(message)\n"
if let handle = FileHandle(forWritingAtPath: surfaceLogPath) {
handle.seekToEndOfFile()
handle.write(Data(line.utf8))
handle.closeFile()
defer { try? handle.close() }
guard (try? handle.seekToEnd()) != nil else { return }
try? handle.write(contentsOf: Data(line.utf8))
} else {
FileManager.default.createFile(atPath: surfaceLogPath, contents: line.data(using: .utf8))
}
Expand All @@ -4155,9 +4155,9 @@ final class TerminalSurface: Identifiable, ObservableObject {
let timestamp = ISO8601DateFormatter().string(from: Date())
let line = "[\(timestamp)] \(message)\n"
if let handle = FileHandle(forWritingAtPath: sizeLogPath) {
handle.seekToEndOfFile()
handle.write(Data(line.utf8))
handle.closeFile()
defer { try? handle.close() }
guard (try? handle.seekToEnd()) != nil else { return }
try? handle.write(contentsOf: Data(line.utf8))
} else {
FileManager.default.createFile(atPath: sizeLogPath, contents: line.data(using: .utf8))
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/WorkspaceContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,9 @@ extension WorkspaceContentView {
let line = "[\(ts)] PANEL NOT FOUND for tabId=\(tab.id) ws=\(workspace.id) panelCount=\(workspace.panels.count)\n"
let logPath = "/tmp/cmux-panel-debug.log"
if let handle = FileHandle(forWritingAtPath: logPath) {
handle.seekToEndOfFile()
handle.write(Data(line.utf8))
handle.closeFile()
defer { try? handle.close() }
guard (try? handle.seekToEnd()) != nil else { return }
try? handle.write(contentsOf: Data(line.utf8))
} else {
FileManager.default.createFile(atPath: logPath, contents: line.data(using: .utf8))
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/bonsplit
Loading