fix(install): escape/Ctrl+C cancels instead of installing globally
Previously, closing the readline (via Escape, Ctrl+C, or stdin closure) would default to global install. Now it cancels the installation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -533,15 +533,12 @@ function promptLocation() {
|
|||||||
// Track whether we've processed the answer to prevent double-execution
|
// Track whether we've processed the answer to prevent double-execution
|
||||||
let answered = false;
|
let answered = false;
|
||||||
|
|
||||||
// Handle readline close event to detect premature stdin closure
|
// Handle readline close event (Ctrl+C, Escape, etc.) - cancel installation
|
||||||
rl.on('close', () => {
|
rl.on('close', () => {
|
||||||
if (!answered) {
|
if (!answered) {
|
||||||
answered = true;
|
answered = true;
|
||||||
console.log(`\n ${yellow}Input stream closed, defaulting to global install${reset}\n`);
|
console.log(`\n ${yellow}Installation cancelled${reset}\n`);
|
||||||
const { settingsPath, settings, statuslineCommand } = install(true);
|
process.exit(0);
|
||||||
handleStatusline(settings, false, (shouldInstallStatusline) => {
|
|
||||||
finishInstall(settingsPath, settings, statuslineCommand, shouldInstallStatusline);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user