From 92d0a14008b3311e80d06152c5c3d1ba09f27369 Mon Sep 17 00:00:00 2001 From: Grzegorz Godlewski Date: Thu, 25 Jul 2024 19:56:41 +0200 Subject: [PATCH] Change process check cause kill -0 seems not to work on alpine for some reason --- src/containers/server/loadRunningInstance.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/containers/server/loadRunningInstance.ts b/src/containers/server/loadRunningInstance.ts index 9c95faa7..ba9be2e7 100644 --- a/src/containers/server/loadRunningInstance.ts +++ b/src/containers/server/loadRunningInstance.ts @@ -11,8 +11,10 @@ export async function loadRunningInstance() { const json = JSON.parse(content); if (json.pid > 0) { try { - // sending the signal 0 to a given PID just checks if any process with the given PID is running, and you have the permission to send a signal to it. - process.kill(json.pid, 0); + // kill -0 seems not to work on alpine for some reason + if (!fs.existsSync('/proc/' + json.pid)) { + return null; + } } catch (err) { return null; }