hedgequantx 1.8.38 → 1.8.39

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": "1.8.38",
3
+ "version": "1.8.39",
4
4
  "description": "Prop Futures Algo Trading CLI - Connect to Topstep, Alpha Futures, and other prop firms",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -9,6 +9,11 @@ const readline = require('readline');
9
9
  // Shared readline instance
10
10
  let rl = null;
11
11
 
12
+ // Prevent readline from exiting on SIGINT during prompts
13
+ process.on('SIGINT', () => {
14
+ // Let the main app handle SIGINT
15
+ });
16
+
12
17
  /**
13
18
  * Get or create readline interface
14
19
  */
@@ -41,13 +46,37 @@ const prepareStdin = () => {
41
46
  * Native readline prompt
42
47
  */
43
48
  const nativePrompt = (message) => {
44
- return new Promise((resolve) => {
45
- prepareStdin();
46
- const r = getReadline();
47
-
48
- r.question(message + ' ', (answer) => {
49
- resolve(answer || '');
50
- });
49
+ return new Promise((resolve, reject) => {
50
+ try {
51
+ prepareStdin();
52
+
53
+ // Always create a fresh readline for each prompt to avoid state issues
54
+ if (rl && !rl.closed) {
55
+ rl.close();
56
+ rl = null;
57
+ }
58
+
59
+ rl = readline.createInterface({
60
+ input: process.stdin,
61
+ output: process.stdout,
62
+ terminal: true
63
+ });
64
+
65
+ // Handle readline close/error
66
+ rl.on('close', () => {
67
+ resolve('');
68
+ });
69
+
70
+ rl.on('error', (err) => {
71
+ resolve('');
72
+ });
73
+
74
+ rl.question(message + ' ', (answer) => {
75
+ resolve(answer || '');
76
+ });
77
+ } catch (e) {
78
+ resolve('');
79
+ }
51
80
  });
52
81
  };
53
82