HeyPuter / phoenix

🔥 Puter's pure-javascript shell
https://puter.com/app/terminal
GNU Affero General Public License v3.0
87 stars 15 forks source link

Only exit the shell if Ctrl-C is pressed with an empty input #71

Closed AtkinsSJ closed 3 months ago

AtkinsSJ commented 3 months ago

Fixes #65.

Handle this in readline(), so that we can respond to it by cancelling the current command input, or (later) terminating a command that is currently executing.

Though, other shells seem to instead only exit if the exit command is run, or sometimes if Ctrl-D is entered. Might want to come back to this eventually.

Also, this is only implemented for Node CLI. I didn't know where to start with making Puter's terminal exit correctly. :sweat_smile:

This also made me notice that Ctrl-C on a previous history item will erase that item. I didn't manage to fix that in the end, but did make some small improvements to the history code while I was there.

KernelDeimos commented 3 months ago

:fire: it's details like this that will prevent frustration when using the shell, which will allow more people to use it seriously