mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +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
|
// Try to read any error output
|
||||||
var errorDetails = "Exit code: \(exitCode)"
|
var errorDetails = "Exit code: \(exitCode)"
|
||||||
if let stderrPipe = self.stderrPipe {
|
if let stderrPipe = self.stderrPipe {
|
||||||
let errorData = stderrPipe.fileHandleForReading.availableData
|
do {
|
||||||
if !errorData.isEmpty, let errorOutput = String(data: errorData, encoding: .utf8) {
|
let errorData = try stderrPipe.fileHandleForReading.readDataToEndOfFile()
|
||||||
errorDetails += "\nError: \(errorOutput.trimmingCharacters(in: .whitespacesAndNewlines))"
|
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