fleetbo-cockpit-cli 1.0.163 → 1.0.164

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.
Files changed (2) hide show
  1. package/cli.js +22 -16
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -982,24 +982,12 @@ 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
- }
1003
991
  }
1004
992
  } catch (e) {}
1005
993
  }
@@ -1007,7 +995,15 @@ else {
1007
995
  const killNetworkService = () => {
1008
996
  if (uplinkProcess) {
1009
997
  try {
1010
- uplinkProcess.kill('SIGINT');
998
+ if (process.platform === 'win32') {
999
+ // Windows ne supporte pas SIGINT sur les process enfants
1000
+ // On utilise taskkill pour forcer la fermeture propre
1001
+ try {
1002
+ execSync(`taskkill /pid ${uplinkProcess.pid} /T /F`, { stdio: 'ignore' });
1003
+ } catch (e) {}
1004
+ } else {
1005
+ uplinkProcess.kill('SIGINT');
1006
+ }
1011
1007
  console.log('[Fleetbo] Engine closed.');
1012
1008
  } catch (e) {
1013
1009
  console.error('[Fleetbo] Error closing tunnel:', e.message);
@@ -1016,7 +1012,7 @@ else {
1016
1012
  };
1017
1013
 
1018
1014
  let isExiting = false;
1019
-
1015
+
1020
1016
  async function cleanupAndExit(code = 0) {
1021
1017
  if (isExiting) return;
1022
1018
  isExiting = true;
@@ -1032,7 +1028,17 @@ else {
1032
1028
  console.log('[Fleetbo] Bye.');
1033
1029
  process.exit(code);
1034
1030
  }
1035
-
1031
+
1032
+ // 🪟 WINDOWS FIX : Ctrl+C est intercepté par cmd.exe avant Node.js
1033
+ // On capture le signal au niveau stdin pour éviter l'invite "O/N"
1034
+ if (process.platform === 'win32') {
1035
+ const rl = require('readline').createInterface({
1036
+ input: process.stdin,
1037
+ output: process.stdout
1038
+ });
1039
+ rl.on('SIGINT', () => cleanupAndExit(0));
1040
+ }
1041
+
1036
1042
  process.on('SIGINT', () => cleanupAndExit(0));
1037
1043
  process.on('SIGTERM', () => cleanupAndExit(0));
1038
1044
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.163",
3
+ "version": "1.0.164",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",