Skip to content

Commit

Permalink
Change process check cause kill -0 seems not to work on alpine for so…
Browse files Browse the repository at this point in the history
…me reason
  • Loading branch information
ggodlewski committed Jul 25, 2024
1 parent fd41e61 commit 92d0a14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/containers/server/loadRunningInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 92d0a14

Please sign in to comment.