@myassis/gateway 1.0.67 → 1.0.68
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.
|
@@ -94,7 +94,9 @@ function getStoredPid() {
|
|
|
94
94
|
try {
|
|
95
95
|
if (!fs_1.default.existsSync(GATEWAY_PID_FILE))
|
|
96
96
|
return null;
|
|
97
|
-
|
|
97
|
+
// 去除 PowerShell Out-File -Encoding UTF8 写入的 BOM(\uFEFF),否则 parseInt 会得到 NaN
|
|
98
|
+
const raw = fs_1.default.readFileSync(GATEWAY_PID_FILE, 'utf8').replace(/^\uFEFF/, '').trim();
|
|
99
|
+
const pid = parseInt(raw, 10);
|
|
98
100
|
return isNaN(pid) ? null : pid;
|
|
99
101
|
}
|
|
100
102
|
catch {
|
|
@@ -149,7 +151,7 @@ async function stopGatewayProcess() {
|
|
|
149
151
|
// 同时杀掉守护进程(防止它重新拉起 gateway)
|
|
150
152
|
if (process.platform === 'win32') {
|
|
151
153
|
try {
|
|
152
|
-
const daemonPidStr = fs_1.default.readFileSync(GATEWAY_DAEMON_PID_FILE, 'utf8').trim();
|
|
154
|
+
const daemonPidStr = fs_1.default.readFileSync(GATEWAY_DAEMON_PID_FILE, 'utf8').replace(/^\uFEFF/, '').trim();
|
|
153
155
|
const daemonPid = parseInt(daemonPidStr, 10);
|
|
154
156
|
if (daemonPid && !isNaN(daemonPid)) {
|
|
155
157
|
try {
|