hxbrief: Improve ctrl-c / exception-safety / completeness of output
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The library makes use of high-level exception-safety constructs (with*, the async library, bracket, …) but there is one test that it (in theory) fails on: If the user presses ctrl-c, the child process gets cancelled. So far so good, but what about output that the child process prints between ctrl-c and getting killed? Unfortunately, hxbrief cancels the "forwarder" thread on ctrl-c too, which means that some stdout/stderr output might get lost in between.
Who cares? Well I don't think it is a big problem usually, but consider this case: You start some process, notice your command was wrong and press ctrl-c. If you had not canceled the process it would have:
- Print message A
- Calculate some stuff
- Print message B
- Run an (intentionally) destructive operation
So naturally you check for message B - if it is not there, the destructive thing has not run and you can simply restart without worrying. But if we "eat" some output, the process might have started running the destructive operation without us ever getting the message B. Just in theory, this could lead to data loss.
To improve this, hxbrief should keep forwarding output from stdout/stderr until the buffers are empty, and only then continue shutting down.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating hxbrief's ctrl-c shutdown handling and the stdout/stderr forwarder, then trace how cancellation affects buffered output. Verify that shutdown waits until both output streams are drained before completing, including output produced after ctrl-c.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100