tamperward 2.20.1 → 2.20.2
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/dist/cli/index.js +15 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -11983,6 +11983,17 @@ function pidAlive2(pid) {
|
|
|
11983
11983
|
return errnoCode(e) === "EPERM";
|
|
11984
11984
|
}
|
|
11985
11985
|
}
|
|
11986
|
+
function observerExited(pid) {
|
|
11987
|
+
if (!pidAlive2(pid)) return true;
|
|
11988
|
+
if (process.platform !== "linux") return false;
|
|
11989
|
+
try {
|
|
11990
|
+
const stat = readFileSync16(`/proc/${pid}/stat`, "utf8");
|
|
11991
|
+
const state = stat.slice(stat.lastIndexOf(")") + 2).split(" ")[0];
|
|
11992
|
+
return state === "Z" || state === "X";
|
|
11993
|
+
} catch (e) {
|
|
11994
|
+
return errnoCode(e) === "ENOENT";
|
|
11995
|
+
}
|
|
11996
|
+
}
|
|
11986
11997
|
function supervisedObserverLog(cwd) {
|
|
11987
11998
|
const gd = gitDir(cwd) ?? join17(cwd, ".git");
|
|
11988
11999
|
return join17(
|
|
@@ -12014,7 +12025,7 @@ function startSupervisedObserver(cwd, base, entry) {
|
|
|
12014
12025
|
while (Date.now() < deadline) {
|
|
12015
12026
|
const telemetry = watcherTelemetry(log);
|
|
12016
12027
|
if (telemetry.state === "healthy" || telemetry.state === "degraded") break;
|
|
12017
|
-
if (
|
|
12028
|
+
if (observerExited(pid)) break;
|
|
12018
12029
|
waitMs(25);
|
|
12019
12030
|
}
|
|
12020
12031
|
return { log, pid, finished: false };
|
|
@@ -12023,17 +12034,14 @@ function stopObserverProcess(observer) {
|
|
|
12023
12034
|
waitMs(100);
|
|
12024
12035
|
const beforeStop = watcherTelemetry(observer.log);
|
|
12025
12036
|
const pid = observer.pid;
|
|
12026
|
-
if (pid !== null &&
|
|
12037
|
+
if (pid !== null && !observerExited(pid)) {
|
|
12027
12038
|
try {
|
|
12028
12039
|
process.kill(pid, "SIGTERM");
|
|
12029
12040
|
} catch {
|
|
12030
12041
|
}
|
|
12031
12042
|
const deadline = Date.now() + 2e3;
|
|
12032
|
-
while (Date.now() < deadline)
|
|
12033
|
-
|
|
12034
|
-
waitMs(25);
|
|
12035
|
-
}
|
|
12036
|
-
if (pidAlive2(pid)) {
|
|
12043
|
+
while (!observerExited(pid) && Date.now() < deadline) waitMs(25);
|
|
12044
|
+
if (!observerExited(pid)) {
|
|
12037
12045
|
try {
|
|
12038
12046
|
process.kill(pid, "SIGKILL");
|
|
12039
12047
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamperward",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.2",
|
|
4
4
|
"description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "hexrift",
|