hedgequantx 2.7.77 → 2.7.78

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.77",
3
+ "version": "2.7.78",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -296,12 +296,36 @@ const stop = async () => {
296
296
  try {
297
297
  if (status.pid) {
298
298
  process.kill(status.pid, 'SIGTERM');
299
+ } else {
300
+ // No PID - try to find and kill by port
301
+ const { execSync } = require('child_process');
302
+ try {
303
+ if (process.platform === 'win32') {
304
+ // Windows: find PID by port and kill
305
+ const result = execSync(`netstat -ano | findstr :${DEFAULT_PORT}`, { encoding: 'utf8' });
306
+ const match = result.match(/LISTENING\s+(\d+)/);
307
+ if (match) process.kill(parseInt(match[1]), 'SIGTERM');
308
+ } else {
309
+ // Unix: use lsof or fuser
310
+ try {
311
+ execSync(`lsof -ti:${DEFAULT_PORT} | xargs kill -9 2>/dev/null || true`, { encoding: 'utf8' });
312
+ } catch (e) {
313
+ // Try fuser as fallback
314
+ execSync(`fuser -k ${DEFAULT_PORT}/tcp 2>/dev/null || true`, { encoding: 'utf8' });
315
+ }
316
+ }
317
+ } catch (e) {
318
+ // Ignore errors - process may already be dead
319
+ }
299
320
  }
300
321
 
301
322
  if (fs.existsSync(PID_FILE)) {
302
323
  fs.unlinkSync(PID_FILE);
303
324
  }
304
325
 
326
+ // Wait for port to be released
327
+ await new Promise(r => setTimeout(r, 1000));
328
+
305
329
  return { success: true, error: null };
306
330
  } catch (error) {
307
331
  return { success: false, error: error.message };