vibe-annotations-server 0.1.2 ā 0.1.4
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/index.js +25 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -59,9 +59,10 @@ function uninstallServer() {
|
|
|
59
59
|
// First try to stop the server if it's running
|
|
60
60
|
try {
|
|
61
61
|
log(' Stopping server first...', colors.dim);
|
|
62
|
-
execSync(`${COMMAND_NAME} stop`, { stdio: 'ignore' });
|
|
62
|
+
execSync(`${COMMAND_NAME} stop`, { stdio: 'ignore', timeout: 5000 });
|
|
63
63
|
} catch {
|
|
64
|
-
// Server might not be running, continue
|
|
64
|
+
// Server might not be running or stop command failed, continue
|
|
65
|
+
log(' (Server stop completed or not running)', colors.dim);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
// Check if server is currently installed
|
|
@@ -90,10 +91,12 @@ function uninstallServer() {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
let childProcess = null;
|
|
95
|
+
|
|
93
96
|
function runCommand(args) {
|
|
94
|
-
|
|
97
|
+
childProcess = spawn(COMMAND_NAME, args, { stdio: 'inherit' });
|
|
95
98
|
|
|
96
|
-
|
|
99
|
+
childProcess.on('error', (error) => {
|
|
97
100
|
if (error.code === 'ENOENT') {
|
|
98
101
|
log('ā Command not found. Installation may have failed.', colors.yellow);
|
|
99
102
|
} else {
|
|
@@ -101,8 +104,9 @@ function runCommand(args) {
|
|
|
101
104
|
}
|
|
102
105
|
});
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
childProcess.on('exit', (code) => {
|
|
108
|
+
childProcess = null;
|
|
109
|
+
process.exit(code || 0);
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
112
|
|
|
@@ -149,10 +153,21 @@ function main() {
|
|
|
149
153
|
runCommand(finalArgs);
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
process.
|
|
156
|
+
// Set up signal handlers
|
|
157
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
158
|
+
signals.forEach(signal => {
|
|
159
|
+
process.on(signal, () => {
|
|
160
|
+
if (childProcess) {
|
|
161
|
+
// Forward signal to child process
|
|
162
|
+
childProcess.kill(signal);
|
|
163
|
+
} else {
|
|
164
|
+
// No child process, exit gracefully
|
|
165
|
+
if (signal === 'SIGINT') {
|
|
166
|
+
log('\nš Shutting down...', colors.yellow);
|
|
167
|
+
}
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
156
171
|
});
|
|
157
172
|
|
|
158
173
|
main();
|