fix(cli): resolve process hang and improve output consistency
- Add process.stdin.destroy() after rl.close() in all interactive commands to properly release stdin and allow process to exit cleanly - Replace raw console.log with logger methods throughout CLI handlers - Convert manual box drawing to logger.logBox() in daemon.ts - Standardize menu formatting with logger.info() and logger.dim() - Improve migration output to only show when migrations actually run Fixes issue where process would not exit after "Setup complete!" message due to stdin keeping the event loop alive.
This commit is contained in:
11
ts/daemon.ts
11
ts/daemon.ts
@@ -207,11 +207,9 @@ export class NupstDaemon {
|
||||
fs.writeFileSync(this.CONFIG_PATH, JSON.stringify(configToSave, null, 2));
|
||||
this.config = configToSave;
|
||||
|
||||
console.log('┌─ Configuration Saved ─────────────────────┐');
|
||||
console.log(`│ Location: ${this.CONFIG_PATH}`);
|
||||
console.log('└──────────────────────────────────────────┘');
|
||||
logger.logBox('Configuration Saved', [`Location: ${this.CONFIG_PATH}`], 45, 'success');
|
||||
} catch (error) {
|
||||
console.error('Error saving configuration:', error);
|
||||
logger.error(`Error saving configuration: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,10 +217,7 @@ export class NupstDaemon {
|
||||
* Helper method to log configuration errors consistently
|
||||
*/
|
||||
private logConfigError(message: string): void {
|
||||
console.error('┌─ Configuration Error ─────────────────────┐');
|
||||
console.error(`│ ${message}`);
|
||||
console.error("│ Please run 'nupst setup' first to create a configuration.");
|
||||
console.error('└───────────────────────────────────────────┘');
|
||||
logger.logBox('Configuration Error', [message, "Please run 'nupst setup' first to create a configuration."], 45, 'error');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user