hedgequantx 2.7.78 → 2.7.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.7.78",
3
+ "version": "2.7.79",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -297,21 +297,30 @@ const stop = async () => {
297
297
  if (status.pid) {
298
298
  process.kill(status.pid, 'SIGTERM');
299
299
  } else {
300
- // No PID - try to find and kill by port
300
+ // No PID - try to find and kill by port (only cli-proxy-api process)
301
301
  const { execSync } = require('child_process');
302
302
  try {
303
303
  if (process.platform === 'win32') {
304
304
  // Windows: find PID by port and kill
305
- const result = execSync(`netstat -ano | findstr :${DEFAULT_PORT}`, { encoding: 'utf8' });
305
+ const result = execSync(`netstat -ano | findstr :${DEFAULT_PORT} | findstr LISTENING`, { encoding: 'utf8' });
306
306
  const match = result.match(/LISTENING\s+(\d+)/);
307
- if (match) process.kill(parseInt(match[1]), 'SIGTERM');
307
+ if (match) {
308
+ const pid = parseInt(match[1]);
309
+ if (pid !== process.pid) process.kill(pid, 'SIGTERM');
310
+ }
308
311
  } else {
309
- // Unix: use lsof or fuser
312
+ // Unix: find PID listening on port, filter to only cli-proxy-api
310
313
  try {
311
- execSync(`lsof -ti:${DEFAULT_PORT} | xargs kill -9 2>/dev/null || true`, { encoding: 'utf8' });
314
+ const result = execSync(`lsof -ti:${DEFAULT_PORT} -sTCP:LISTEN 2>/dev/null || true`, { encoding: 'utf8' });
315
+ const pids = result.trim().split('\n').filter(p => p && parseInt(p) !== process.pid);
316
+ for (const pidStr of pids) {
317
+ const pid = parseInt(pidStr);
318
+ if (pid && pid !== process.pid) {
319
+ try { process.kill(pid, 'SIGTERM'); } catch (e) { /* ignore */ }
320
+ }
321
+ }
312
322
  } catch (e) {
313
- // Try fuser as fallback
314
- execSync(`fuser -k ${DEFAULT_PORT}/tcp 2>/dev/null || true`, { encoding: 'utf8' });
323
+ // Ignore errors
315
324
  }
316
325
  }
317
326
  } catch (e) {