@samitouri / QOSami-HFS / commits / 2e92561f

fix: (regression 0.57) you had to ctrl-c twice to quit

Massimo Melina committed Mar 2, 2026 at 19:22 UTC 2e92561ffd44a7ac2f79fcdf3d9d6147c8a8a023
1 file changed +2 -1
src/commands.ts
+2 -1
@@ -23,7 +23,8 @@ if (!argv.updating && !showHelp) {
23 // Not sure if the try is necessary for when stdin is unavailable, but someone reported a problem using nohup https://github.com/rejetto/hfs/issues/74 and I've found this example try-catching https://github.com/DefinitelyTyped/DefinitelyTyped/blob/dda83a906914489e09ca28afea12948529015d4a/types/node/readline.d.ts#L489
24 const tty = process.stdin.isTTY && process.stdout.isTTY || undefined
25 const prompter = createInterface({ input: process.stdin, output: process.stdout, prompt: tty && 'command> ' })
26 - .on('line', x => parseCommandLine(x).then(showPrompt))
26 + .on('line', x => parseCommandLine(x).then(showPrompt))
27 + .on('SIGINT', () => process.emit('SIGINT')) // readline swallows the first ctrl+c unless we forward it to process-level handlers
28
29 let isClean = true
30 let cleaning: undefined | Promise<void>