fleetbo-cockpit-cli 1.0.161 → 1.0.163
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/cli.js +13 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -982,12 +982,24 @@ else if (['page', 'g', 'generate'].includes(command)) {
|
|
|
982
982
|
// ============================================
|
|
983
983
|
else {
|
|
984
984
|
const NULL_DEV = process.platform === 'win32' ? '>nul 2>&1' : '2>/dev/null';
|
|
985
|
-
|
|
985
|
+
|
|
986
986
|
function killProcessOnPort(port) {
|
|
987
987
|
try {
|
|
988
988
|
if (process.platform !== 'win32') {
|
|
989
989
|
const pid = execSync(`lsof -ti:${port} ${NULL_DEV}`).toString().trim();
|
|
990
990
|
if (pid) execSync(`kill -9 ${pid.split('\n').join(' ')} ${NULL_DEV}`);
|
|
991
|
+
} else {
|
|
992
|
+
// 🪓 LE TUEUR DE ZOMBIES WINDOWS
|
|
993
|
+
// Cherche l'ID du processus (PID) qui utilise notre port, et le tue de force (/F)
|
|
994
|
+
const output = execSync(`netstat -ano | findstr :${port}`).toString();
|
|
995
|
+
const lines = output.split('\n');
|
|
996
|
+
for (const line of lines) {
|
|
997
|
+
const parts = line.trim().split(/\s+/);
|
|
998
|
+
if (parts.length >= 5 && parts[1].includes(`:${port}`)) {
|
|
999
|
+
const pid = parts[parts.length - 1];
|
|
1000
|
+
execSync(`taskkill /PID ${pid} /F /T >nul 2>&1`);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
991
1003
|
}
|
|
992
1004
|
} catch (e) {}
|
|
993
1005
|
}
|