Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
test: keep reaped browser processes marked stopped (#11233)
Adam Eivyd5ca02e80527
diff --git a/server/test/processAlive.js b/server/test/processAlive.jsindex 01973fad8a..190ffe5ec0 100644--- a/server/test/processAlive.js+++ b/server/test/processAlive.js@@ -18,6 +18,9 @@ export function isProcessAlive(pid) {// the state letter is the first token after the LAST ')'.return stat.slice(stat.lastIndexOf(')') + 2, stat.lastIndexOf(')') + 3) !== 'Z';} catch {- return true;+ // The child may have been reaped between signal-0 and reading /proc.+ // Probe again rather than turning a completed exit back into "alive".+ // This also preserves the signal-0 fallback on platforms without /proc.+ try { process.kill(pid, 0); return true; } catch { return false; }}}diff --git a/server/test/processAlive.test.js b/server/test/processAlive.test.jsindex 2a5fcc5d83..64a83439f6 100644--- a/server/test/processAlive.test.js+++ b/server/test/processAlive.test.js@@ -80,6 +80,21 @@ describe('isProcessAlive', () => {expect(isProcessAlive(12345)).toBe(true);});+ it('keeps a zombie dead when it is reaped during the next liveness probe', () => {+ vi.spyOn(process, 'kill')+ .mockReturnValueOnce(true)+ .mockReturnValueOnce(true)+ .mockImplementationOnce(() => { throw new Error('ESRCH'); });+ mocks.readFileSync.mockReturnValueOnce('12345 (node) Z 1 2 3').mockImplementationOnce(() => {+ const error = new Error('stat disappeared after the signal probe');+ error.code = 'ENOENT';+ throw error;+ });++ expect(isProcessAlive(12345)).toBe(false);+ expect(isProcessAlive(12345)).toBe(false);+ });+it('falls back to process.kill(pid, 0) when /proc/<pid>/stat is unavailable (e.g. macOS)', () => {vi.spyOn(process, 'kill').mockImplementation((pid, sig) => {if (pid === 12345 && sig === 0) return true;