fleetbo-cockpit-cli 1.0.166 → 1.0.167

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 +15 -20
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -27,7 +27,6 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
27
27
  const PORT = 3000;
28
28
 
29
29
  let uplinkProcess = null;
30
- let devServerProcess = null;
31
30
  const args = process.argv.slice(2);
32
31
  const command = args[0];
33
32
 
@@ -986,31 +985,23 @@ else {
986
985
 
987
986
  function killProcessOnPort(port) {
988
987
  try {
989
- if (process.platform === 'win32') {
990
- execSync(`for /f "tokens=5" %a in ('netstat -aon ^| find ":${port}"') do taskkill /F /PID %a`, { stdio: 'ignore', shell: true });
991
- } else {
988
+ if (process.platform !== 'win32') {
992
989
  const pid = execSync(`lsof -ti:${port} ${NULL_DEV}`).toString().trim();
993
990
  if (pid) execSync(`kill -9 ${pid.split('\n').join(' ')} ${NULL_DEV}`);
994
991
  }
995
992
  } catch (e) {}
996
993
  }
997
-
998
- function killDevServer() {
999
- if (!devServerProcess) return;
1000
- try {
1001
- if (process.platform === 'win32') {
1002
- execSync(`taskkill /pid ${devServerProcess.pid} /T /F`, { stdio: 'ignore' });
1003
- } else {
1004
- devServerProcess.kill('SIGKILL');
1005
- }
1006
- } catch (e) {}
1007
- devServerProcess = null;
1008
- }
1009
994
 
1010
995
  const killNetworkService = () => {
1011
996
  if (uplinkProcess) {
1012
997
  try {
1013
- uplinkProcess.kill('SIGINT');
998
+ if (process.platform === 'win32') {
999
+ spawn('taskkill', ['/pid', String(uplinkProcess.pid), '/T', '/F'], {
1000
+ stdio: 'ignore', detached: true, shell: false
1001
+ }).unref();
1002
+ } else {
1003
+ uplinkProcess.kill('SIGINT');
1004
+ }
1014
1005
  console.log('[Fleetbo] Engine closed.');
1015
1006
  } catch (e) {
1016
1007
  console.error('[Fleetbo] Error closing tunnel:', e.message);
@@ -1031,12 +1022,17 @@ else {
1031
1022
  console.error('[Fleetbo] Network cleanup warning:', e.message);
1032
1023
  }
1033
1024
  killNetworkService();
1034
- killDevServer();
1035
1025
  killProcessOnPort(PORT);
1036
1026
  console.log('[Fleetbo] Bye.');
1037
1027
  process.exit(code);
1038
1028
  }
1039
1029
 
1030
+ // 🪟 WINDOWS FIX : capture Ctrl+C via readline pour éviter l'invite "O/N"
1031
+ if (process.platform === 'win32') {
1032
+ const rlWin = require('readline').createInterface({ input: process.stdin, output: process.stdout });
1033
+ rlWin.on('SIGINT', () => cleanupAndExit(0));
1034
+ }
1035
+
1040
1036
  process.on('SIGINT', () => cleanupAndExit(0));
1041
1037
  process.on('SIGTERM', () => cleanupAndExit(0));
1042
1038
 
@@ -1070,7 +1066,7 @@ else {
1070
1066
  const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
1071
1067
 
1072
1068
  // ✅ On passe la chaîne complète, SANS tableau d'arguments du tout !
1073
- devServerProcess = spawn(`${npmCmd} run dev --silent`, {
1069
+ const devServer = spawn(`${npmCmd} run dev --silent`, {
1074
1070
  stdio: ['ignore', 'pipe', 'pipe'],
1075
1071
  shell: true,
1076
1072
  env: {
@@ -1079,7 +1075,6 @@ else {
1079
1075
  PORT: PORT.toString(),
1080
1076
  }
1081
1077
  });
1082
- const devServer = devServerProcess;
1083
1078
  //devServer.stdout.pipe(process.stdout);
1084
1079
  devServer.stderr.pipe(process.stderr);
1085
1080
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.166",
3
+ "version": "1.0.167",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",