@drocketxx/pm2me 1.1.18 → 1.1.20
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.
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/png" href="/icon.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>PM2Me</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CtJh3zNJ.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-Bo3lbcQo.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/backend/routes/api.js
CHANGED
|
@@ -1059,17 +1059,33 @@ router.post('/system/update', async (req, res) => {
|
|
|
1059
1059
|
const isGlobal = !fs.existsSync(path.resolve(__dirname, '../../.git'));
|
|
1060
1060
|
let cmd, cwd;
|
|
1061
1061
|
if (isGlobal) {
|
|
1062
|
-
|
|
1062
|
+
// Run in background/detached mode so it continues after service uninstall
|
|
1063
|
+
if (isWindows) {
|
|
1064
|
+
cmd = 'powershell -Command "Start-Process powershell -ArgumentList \'-Command\',\'npm install -g @drocketxx/pm2me@latest; pm2me service uninstall; pm2me service install\' -WindowStyle Hidden"';
|
|
1065
|
+
} else {
|
|
1066
|
+
cmd = 'nohup sh -c "npm install -g @drocketxx/pm2me@latest && pm2me service uninstall && pm2me service install" > /tmp/pm2me-update.log 2>&1 &';
|
|
1067
|
+
}
|
|
1063
1068
|
cwd = '/';
|
|
1064
1069
|
} else {
|
|
1065
1070
|
cmd = 'git pull origin main && npm run build';
|
|
1066
1071
|
cwd = path.resolve(__dirname, '../..');
|
|
1067
1072
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
+
|
|
1074
|
+
// For global install, spawn detached and return immediately
|
|
1075
|
+
if (isGlobal) {
|
|
1076
|
+
exec(cmd, { cwd, windowsHide: true, detached: true });
|
|
1077
|
+
res.json({
|
|
1078
|
+
success: true,
|
|
1079
|
+
output: 'Update started in background. Service will restart automatically in ~30 seconds.',
|
|
1080
|
+
cmd
|
|
1081
|
+
});
|
|
1082
|
+
} else {
|
|
1083
|
+
const { stdout, stderr } = await execAsync(cmd, { cwd, windowsHide: true }).catch(err => ({
|
|
1084
|
+
stdout: '', stderr: err.message
|
|
1085
|
+
}));
|
|
1086
|
+
const output = [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
1087
|
+
res.json({ success: !stderr.includes('error'), output, cmd });
|
|
1088
|
+
}
|
|
1073
1089
|
} catch (err) {
|
|
1074
1090
|
res.status(500).json({ error: err.message });
|
|
1075
1091
|
}
|