This repository was archived by the owner on Aug 31, 2023. It is now read-only.
fix(rome_cli): prevent the socket transport from printing an error on shutdown #3417
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.
Summary
Fixes #3414
This PR adds special handling for the
rome/shutdown
command in theSocketTransport
to make it gracefully handle the connection being immediately terminated by the server on reception of the shutdown request.Test Plan
Unfortunately this area of the CLI is hard to test since the tests would need to actually start and stop a daemon instance on the host system. Additionally in this case since the read and write tasks write their error directly to
stderr
(since they cannot share access to theConsole
object) it wouldn't be possible for the tests to ensure that nothing was printed to the output.Instead I simply ran the
rome start
androme stop
commands in sequence to ensure it never printed an error message (I ran this a few times to make sure it couldn't be triggered randomly due to concurrency)