Print instructions and info on interrupt - #303
Merged
Merged
Conversation
DanGould
marked this pull request as draft
June 26, 2024 04:48
DanGould
commented
Jun 26, 2024
spacebear21
requested changes
Jun 27, 2024
| Ok(()) | ||
| } | ||
| _ = interrupt.changed() => { | ||
| Err(anyhow!("Interrupted. Call `send` with the same arguments to resume this session or `resume` to resume all sessions.")) |
Collaborator
There was a problem hiding this comment.
This is for the receiver.
Suggested change
| Err(anyhow!("Interrupted. Call `send` with the same arguments to resume this session or `resume` to resume all sessions.")) | |
| Err(anyhow!("Interrupted. Call the `resume` command to resume all sessions.")) |
| Ok(()) | ||
| } | ||
| _ = interrupt.changed() => { | ||
| Err(anyhow!("Interrupted. Call `send` with the same arguments to resume this session or `resume` to resume all sessions.")) |
Collaborator
There was a problem hiding this comment.
Why not println! instead of returning an error (like in resume)? As it stands it prints: "Error: Interrupted. Call send with the same arguments to resume this session or resume to resume all sessions."
Member
Author
There was a problem hiding this comment.
Doh! I was wondering why this looked so wrong. An interrupt isn't an error, it's just a different Ok path. Adopted.
Print an informative message on how to proceed when any `send`, `receive`, or `resume` command is interrupted. Use `tokio::signal::ctrl_c` to do this without introducing any new dependency.
Member
Author
|
I've adopted your suggestions and also refactored |
17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Interrupting the program just killed it. Now it prints messages
send: "Interrupted. Callsendwith the same arguments to resume this session orresumeto resume all sessions.""receive: "Interrupted. Call theresumecommand to resume all sessions."resume: "Interrupted. Call theresumecommand to resume all sessions."Before this change, resume even printed "All sessions completed" on interrupt.
I'm not the most pleased with the resume interrupt but it's late and I didn't want to lose the train of thought while I had it. It was hastily put together with an LLM and will need a good review before it's even eligible for merge. Would be nice for 0.0.7-alpha but it's low priority, I just wanted to get a draft working before my mind switched off of it.