Replace PM2 definitions during profile reset

This commit is contained in:
2026-07-25 14:03:33 +00:00
parent 87e303734a
commit d964a28465
2 changed files with 7 additions and 5 deletions
@@ -975,13 +975,14 @@ export class GatewayOrchestrator implements GatewayOrchestratorHandle {
try { try {
await this.processManager.stop(name); await this.processManager.stop(name);
} catch { } catch {
// Deleting the definition below also terminates a process that raced with stop.
}
try { try {
await this.processManager.delete(name); await this.processManager.delete(name);
} catch (error) { } catch (error) {
failures.push(`${name}: ${error instanceof Error ? error.message : String(error)}`); failures.push(`${name}: ${error instanceof Error ? error.message : String(error)}`);
} }
} }
}
if (failures.length > 0) { if (failures.length > 0) {
throw new Error(`Failed to stop profile processes: ${failures.join('; ')}`); throw new Error(`Failed to stop profile processes: ${failures.join('; ')}`);
} }
@@ -153,6 +153,7 @@ describe('GatewayOrchestrator first-class operations', () => {
expect(harness.statuses).toEqual(['STOPPED']); expect(harness.statuses).toEqual(['STOPPED']);
expect(harness.stopped).toEqual(['sammo:che:2:game-api', 'sammo:che:2:turn-daemon']); expect(harness.stopped).toEqual(['sammo:che:2:game-api', 'sammo:che:2:turn-daemon']);
expect(harness.deleted).toEqual(['sammo:che:2:game-api', 'sammo:che:2:turn-daemon']);
expect(harness.completions).toEqual(['SUCCEEDED']); expect(harness.completions).toEqual(['SUCCEEDED']);
}); });