Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

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

Merged
merged 4 commits into from
Mar 29, 2024

Conversation

AtkinsSJ
Copy link
Contributor

@AtkinsSJ AtkinsSJ commented Mar 29, 2024

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. 😅

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.

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.
@KernelDeimos
Copy link
Collaborator

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

@KernelDeimos KernelDeimos merged commit ae2b11b into HeyPuter:trunk Mar 29, 2024
3 checks passed
@AtkinsSJ AtkinsSJ deleted the ctrl-c-interception branch March 29, 2024 19:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SIGINT (Ctrl-C) always quits shell while running in Node
2 participants