Show server PID in settings

This commit is contained in:
Peter Steinberger 2025-07-28 14:13:39 +02:00
parent 6a918aeab6
commit 969fd2e327
3 changed files with 17 additions and 0 deletions

View file

@ -47,6 +47,11 @@ final class BunServer {
var bindAddress: String = "127.0.0.1"
/// The process identifier of the running server, if available
var processIdentifier: Int32? {
process?.processIdentifier
}
/// Local authentication token for bypassing auth on localhost
private let localAuthToken: String = {
// Generate a secure random token for this session

View file

@ -101,6 +101,11 @@ class ServerManager {
private(set) var isRestarting = false
private(set) var lastError: Error?
/// The process ID of the running server, if available
var serverProcessId: Int32? {
bunServer?.processIdentifier
}
/// Track if we're in the middle of handling a crash to prevent multiple restarts
private var isHandlingCrash = false
/// Number of consecutive crashes for backoff

View file

@ -216,6 +216,13 @@ private struct ServerStatusSection: View {
.font(.system(.body, design: .monospaced))
}
}
if let pid = serverManager.serverProcessId {
LabeledContent("Process ID") {
Text("\(pid)")
.font(.system(.body, design: .monospaced))
}
}
}
Divider()