bombshell-dev / clack

Effortlessly build beautiful command-line apps
https://clack.cc
5.53k stars 90 forks source link

[Bug]: spinner with ctrl+c dont working #103

Closed productdevbook closed 1 year ago

productdevbook commented 1 year ago

Environment

Describe the bug ctrl + c dont working with spinner. Whenever I add spinnir code, all ctrl commands are disabled.

dont working terminal ctrl + c kill.

import { execa, execaSync } from 'execa'

const s = p.spinner()
s.start('Emulator başlatılıyor')
s.stop('Emulator başlatıldı')

execaSync('pnpm', ['dev:app'], { stdio: 'inherit', detached: true })

working

import { execa, execaSync } from 'execa'

execaSync('pnpm', ['dev:app'], { stdio: 'inherit', detached: true })
ulken commented 1 year ago

Hum, I'm unable to reproduce. Using the basic example, ctrl+c exists the program (doesn't show an exit message, though, since the program abruptly exits). Not sure if by design or not. @natemoo-re?

What OS are you using?

ulken commented 1 year ago

https://user-images.githubusercontent.com/516549/223576891-9ba93558-cca4-4c7e-8767-4eda80269ee1.mov

ulken commented 1 year ago

Oh, now I think I understand what you mean. You mean after, not during the spinner?

I can confirm that's a bug.

ulken commented 1 year ago

This behavior seems to have been introduced in #80, as commenting out that line makes the program respond to control sequences again.

However, restoring raw mode as well seems to allow both fixes to co-exist.

(input.isTTY) input.setRawMode(false);

// cc @privatenumber