archicore 0.1.4 → 0.1.5
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.
|
@@ -18,6 +18,15 @@ const state = {
|
|
|
18
18
|
user: null,
|
|
19
19
|
};
|
|
20
20
|
export async function startInteractiveMode() {
|
|
21
|
+
// Prevent process from exiting on unhandled errors
|
|
22
|
+
process.on('uncaughtException', (error) => {
|
|
23
|
+
printError(`Unexpected error: ${error.message}`);
|
|
24
|
+
console.log();
|
|
25
|
+
});
|
|
26
|
+
process.on('unhandledRejection', (reason) => {
|
|
27
|
+
printError(`Unhandled promise rejection: ${reason}`);
|
|
28
|
+
console.log();
|
|
29
|
+
});
|
|
21
30
|
// Check if initialized in current directory
|
|
22
31
|
const initialized = await isInitialized(state.projectPath);
|
|
23
32
|
if (!initialized) {
|
|
@@ -102,14 +111,34 @@ export async function startInteractiveMode() {
|
|
|
102
111
|
});
|
|
103
112
|
rl.on('close', () => {
|
|
104
113
|
if (state.running) {
|
|
105
|
-
// Unexpected close
|
|
114
|
+
// Unexpected close - don't exit, restart readline
|
|
115
|
+
console.log();
|
|
116
|
+
printWarning('Input stream interrupted, restarting...');
|
|
117
|
+
// Recreate readline interface
|
|
118
|
+
const newRl = readline.createInterface({
|
|
119
|
+
input: process.stdin,
|
|
120
|
+
output: process.stdout,
|
|
121
|
+
terminal: true,
|
|
122
|
+
});
|
|
123
|
+
newRl.on('line', (input) => {
|
|
124
|
+
processLine(input).catch((err) => {
|
|
125
|
+
printError(String(err));
|
|
126
|
+
prompt();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
newRl.on('close', () => {
|
|
130
|
+
if (!state.running) {
|
|
131
|
+
printGoodbye();
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
106
135
|
console.log();
|
|
107
|
-
|
|
136
|
+
prompt();
|
|
108
137
|
}
|
|
109
138
|
else {
|
|
110
139
|
printGoodbye();
|
|
140
|
+
process.exit(0);
|
|
111
141
|
}
|
|
112
|
-
process.exit(0);
|
|
113
142
|
});
|
|
114
143
|
// Handle SIGINT (Ctrl+C)
|
|
115
144
|
process.on('SIGINT', () => {
|