mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
Add OpenCode install method detection and improve process termination handling
This commit is contained in:
1 parent
bdd0408346
commit
e3cf6482ef
2 files changed
+41
-6
No files matched your search
@@ -185,7 +185,12 @@ class OpenCodeServerManager {
|
||||
try {
|
||||
process.kill(this.serverPid, 'SIGTERM')
|
||||
} catch (error) {
|
||||
logger.warn(`Failed to send SIGTERM to ${this.serverPid}:`, error)
|
||||
const errorCode = error && typeof error === 'object' && 'code' in error ? (error as { code: string }).code : ''
|
||||
if (errorCode === 'ESRCH') {
|
||||
logger.debug(`Process ${this.serverPid} already stopped`)
|
||||
} else {
|
||||
logger.warn(`Failed to send SIGTERM to ${this.serverPid}:`, error)
|
||||
}
|
||||
}
|
||||
|
||||
await new Promise(r => setTimeout(r, 2000))
|
||||
@@ -193,7 +198,12 @@ class OpenCodeServerManager {
|
||||
try {
|
||||
process.kill(this.serverPid, 'SIGKILL')
|
||||
} catch (error) {
|
||||
logger.warn(`Failed to send SIGKILL to ${this.serverPid}:`, error)
|
||||
const errorCode = error && typeof error === 'object' && 'code' in error ? (error as { code: string }).code : ''
|
||||
if (errorCode === 'ESRCH') {
|
||||
logger.debug(`Process ${this.serverPid} already stopped`)
|
||||
} else {
|
||||
logger.warn(`Failed to send SIGKILL to ${this.serverPid}:`, error)
|
||||
}
|
||||
}
|
||||
|
||||
this.serverPid = null
|
||||
|
||||
Reference in new issue
Block a user