We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95a22e8 commit 097cd38Copy full SHA for 097cd38
packages/desktop/src/utils/unixIsChildProcess.js
@@ -0,0 +1,20 @@
1
+import fs from "node:fs"
2
+
3
+export default async (pid, parentPid) => {
4
+ try {
5
+ const status = await fs.promises.readFile(`/proc/${pid}/status`, "utf8")
6
7
+ const match = status.match(/^PPid:\s+(\d+)/m)
8
9
+ if (match && match[1]) {
10
+ const ppid = parseInt(match[1], 10)
11
12
+ return ppid === parentPid
13
+ }
14
15
+ return false
16
+ } catch (error) {
17
+ console.error("Failed to check process:", error)
18
19
20
+}
0 commit comments