This commit is contained in:
2025-08-28 15:47:59 +00:00
parent 1c2310c185
commit 33fb02733d
30 changed files with 1061 additions and 1070 deletions

View File

@@ -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(() => {});