mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-18 13:25:52 +00:00
Don't crash here
This commit is contained in:
parent
7db96f4138
commit
cb9d0683b4
1 changed files with 8 additions and 3 deletions
|
|
@ -229,9 +229,14 @@ final class BunServer {
|
|||
// Try to read any error output
|
||||
var errorDetails = "Exit code: \(exitCode)"
|
||||
if let stderrPipe = self.stderrPipe {
|
||||
let errorData = stderrPipe.fileHandleForReading.availableData
|
||||
if !errorData.isEmpty, let errorOutput = String(data: errorData, encoding: .utf8) {
|
||||
errorDetails += "\nError: \(errorOutput.trimmingCharacters(in: .whitespacesAndNewlines))"
|
||||
do {
|
||||
let errorData = try stderrPipe.fileHandleForReading.readDataToEndOfFile()
|
||||
if !errorData.isEmpty, let errorOutput = String(data: errorData, encoding: .utf8) {
|
||||
errorDetails += "\nError: \(errorOutput.trimmingCharacters(in: .whitespacesAndNewlines))"
|
||||
}
|
||||
} catch {
|
||||
// File handle might be invalid if process exited immediately
|
||||
logger.debug("Could not read stderr: \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue