muuuuse 1.4.1 → 1.4.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/package.json +1 -1
- package/src/runtime.js +11 -28
package/package.json
CHANGED
package/src/runtime.js
CHANGED
|
@@ -299,7 +299,10 @@ class ArmedSeat {
|
|
|
299
299
|
this.child.onData((data) => {
|
|
300
300
|
fs.appendFileSync(this.paths.pipePath, data);
|
|
301
301
|
if (!this.stopped) {
|
|
302
|
-
|
|
302
|
+
const visibleData = String(data).replace(/\u0007/g, "");
|
|
303
|
+
if (visibleData) {
|
|
304
|
+
process.stdout.write(visibleData);
|
|
305
|
+
}
|
|
303
306
|
}
|
|
304
307
|
});
|
|
305
308
|
|
|
@@ -731,6 +734,9 @@ class ArmedSeat {
|
|
|
731
734
|
}
|
|
732
735
|
|
|
733
736
|
if (this.child && !this.childExit) {
|
|
737
|
+
if (this.childPid && isPidAlive(this.childPid)) {
|
|
738
|
+
signalProcessFamily(this.childPid, "SIGKILL");
|
|
739
|
+
}
|
|
734
740
|
try {
|
|
735
741
|
this.child.kill();
|
|
736
742
|
} catch {
|
|
@@ -848,9 +854,7 @@ function stopAllSessions() {
|
|
|
848
854
|
if (seat.childLive) {
|
|
849
855
|
signalProcessFamily(seat.childPid, "SIGHUP");
|
|
850
856
|
signalProcessFamily(seat.childPid, "SIGTERM");
|
|
851
|
-
|
|
852
|
-
signalProcessFamily(seat.childPid, "SIGKILL");
|
|
853
|
-
}
|
|
857
|
+
signalProcessFamily(seat.childPid, "SIGKILL");
|
|
854
858
|
}
|
|
855
859
|
|
|
856
860
|
if (seat.wrapperLive) {
|
|
@@ -886,12 +890,9 @@ function signalPid(pid, signal) {
|
|
|
886
890
|
}
|
|
887
891
|
|
|
888
892
|
function signalProcessTree(rootPid, signal) {
|
|
889
|
-
|
|
890
|
-
return 0;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
+
const descendants = getChildProcesses(rootPid);
|
|
893
894
|
let delivered = 0;
|
|
894
|
-
for (const process of
|
|
895
|
+
for (const process of descendants) {
|
|
895
896
|
if (signalPid(process.pid, signal)) {
|
|
896
897
|
delivered += 1;
|
|
897
898
|
}
|
|
@@ -904,26 +905,8 @@ function signalProcessTree(rootPid, signal) {
|
|
|
904
905
|
return delivered;
|
|
905
906
|
}
|
|
906
907
|
|
|
907
|
-
function signalProcessGroup(rootPid, signal) {
|
|
908
|
-
if (!Number.isInteger(rootPid) || rootPid <= 0) {
|
|
909
|
-
return false;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
try {
|
|
913
|
-
process.kill(-rootPid, signal);
|
|
914
|
-
return true;
|
|
915
|
-
} catch {
|
|
916
|
-
return false;
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
|
|
920
908
|
function signalProcessFamily(rootPid, signal) {
|
|
921
|
-
|
|
922
|
-
if (signalProcessGroup(rootPid, signal)) {
|
|
923
|
-
delivered += 1;
|
|
924
|
-
}
|
|
925
|
-
delivered += signalProcessTree(rootPid, signal);
|
|
926
|
-
return delivered;
|
|
909
|
+
return signalProcessTree(rootPid, signal);
|
|
927
910
|
}
|
|
928
911
|
|
|
929
912
|
function clearStaleStopRequest(stopPath, startedAtMs) {
|