amalgm 0.1.59 → 0.1.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/process-cleanup.js +13 -2
- package/package.json +1 -1
package/lib/process-cleanup.js
CHANGED
|
@@ -99,7 +99,7 @@ function listProcProcesses() {
|
|
|
99
99
|
pid,
|
|
100
100
|
ppid: readProcPpid(pid),
|
|
101
101
|
command: readProcCommand(pid),
|
|
102
|
-
env:
|
|
102
|
+
env: null,
|
|
103
103
|
}))
|
|
104
104
|
.filter((item) => item.command);
|
|
105
105
|
} catch {
|
|
@@ -133,7 +133,8 @@ function listPsProcesses() {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
function listProcesses() {
|
|
136
|
-
const
|
|
136
|
+
const psProcesses = listPsProcesses();
|
|
137
|
+
const processes = psProcesses.length > 0 ? psProcesses : (listProcProcesses() || []);
|
|
137
138
|
const commandByPid = new Map(processes.map((item) => [item.pid, item.command]));
|
|
138
139
|
return processes.map((item) => ({
|
|
139
140
|
...item,
|
|
@@ -141,6 +142,14 @@ function listProcesses() {
|
|
|
141
142
|
}));
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
function withEnv(item) {
|
|
146
|
+
if (!item || item.env) return item;
|
|
147
|
+
return {
|
|
148
|
+
...item,
|
|
149
|
+
env: readProcEnv(item.pid),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
function normalizedCommand(command) {
|
|
145
154
|
return String(command || '').replace(/\\/g, '/');
|
|
146
155
|
}
|
|
@@ -195,6 +204,7 @@ function runtimeServiceProcesses(options = {}) {
|
|
|
195
204
|
return listProcesses()
|
|
196
205
|
.filter((item) => !exclude.has(item.pid))
|
|
197
206
|
.filter((item) => commandLooksLikeRuntimeService(item.command, item, options))
|
|
207
|
+
.map(withEnv)
|
|
198
208
|
.filter((item) => envMatchesAmalgmDir(item.env));
|
|
199
209
|
}
|
|
200
210
|
|
|
@@ -203,6 +213,7 @@ function supervisorProcesses(options = {}) {
|
|
|
203
213
|
return listProcesses()
|
|
204
214
|
.filter((item) => !exclude.has(item.pid))
|
|
205
215
|
.filter((item) => commandLooksLikeSupervisor(item.command))
|
|
216
|
+
.map(withEnv)
|
|
206
217
|
.filter((item) => envMatchesAmalgmDir(item.env));
|
|
207
218
|
}
|
|
208
219
|
|