update
This commit is contained in:
@@ -101,10 +101,8 @@ export class TspmIpcClient {
|
||||
params: RequestForMethod<M>,
|
||||
): Promise<ResponseForMethod<M>> {
|
||||
if (!this.isConnected || !this.ipcClient) {
|
||||
throw new Error(
|
||||
'Not connected to TSPM daemon.\n' +
|
||||
'Run "tspm daemon start" or "tspm enable" first.'
|
||||
);
|
||||
// Try to connect first
|
||||
await this.connect();
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -162,15 +160,16 @@ export class TspmIpcClient {
|
||||
// Check if process is running
|
||||
try {
|
||||
process.kill(pid, 0);
|
||||
|
||||
// Also check if socket exists and is accessible
|
||||
|
||||
// PID is alive, daemon is running
|
||||
// Socket check is advisory only - the connect retry will handle transient socket issues
|
||||
try {
|
||||
await fs.promises.access(this.socketPath);
|
||||
return true;
|
||||
} catch {
|
||||
// Socket doesn't exist, daemon might be starting
|
||||
return false;
|
||||
// Socket might be missing temporarily, but daemon is alive
|
||||
// Let the connection retry logic handle this
|
||||
}
|
||||
return true;
|
||||
} catch {
|
||||
// Process doesn't exist, clean up stale PID file
|
||||
await fs.promises.unlink(this.daemonPidFile).catch(() => {});
|
||||
|
Reference in New Issue
Block a user