Repository navigation
Fix/corrupted json output - #100
Merged
Merged
Conversation
The flag promised a singular document, but broke in the following functions/files 1. confirm() 2. src/utils/fs.rs 3. help <command> 4. version Now outputs to stderr and the 4 sources of the bug no longer ask for that document. Instead throwing a new error: BallError::ConfirmationRequired Tested on Windows and Linux
`baller --json roster <name>` printed "Searching '<name>' not found locally, searching registries..." on stdout ahead of the search document whenever the name was not on the roster, so the output failed jq. The notice is progress output and now goes through tracing: on stderr, and hidden by -q and --json. The same match fell back to a registry search on any lookup error; only PackageNotFound does now, so a roster that cannot be read is reported rather than searched. Child processes inherit stdout too: hook scripts, sudo apt-get/dnf/ pacman and cargo install wrote ahead of the JSON document. Under --json their stdout now goes to stderr (utils::output::child_stdout, with the mode set once in main); text mode is unchanged. --quiet keeps printing `version`: it hides progress, never a command's result. Documented, and pinned by a test. Tested with three new tests in tests/json_output.rs, each failing when its fix is reverted, on Linux and on a Windows 11 VM. The hook test fails under Wine only, whose powershell is a stub. Closes #40 Closes #41
Installing a system package printed "System installing via apt... quiet=false" on stderr. The tracing migration (#32) kept the quiet argument of the old output::info(quiet, msg) helper on one call in draft.rs, and tracing reads it as a field to print. The tracer already drops info lines under -q and --json, so the argument is removed; the leftover test_info_is_quiet_safe, which still exercised tracing::info!(bool, ...), goes with it. Two Referee integration tests failed intermittently on the Windows CI runner. MockServer polls a non-blocking listener, and on Windows an accepted socket inherits that mode, voiding read_request's read timeout: a request still in flight at accept time read as WouldBlock and was dropped unrecorded. read_request now restores blocking mode. The new test_the_mock_server_waits_for_a_request_that_arrives_late sends its request 200 ms after connecting. Built without the fix it failed 3 of 3 runs on a Windows 11 VM and under Wine; with the fix it passed 3 of 3. Linux does not inherit the mode, so the test passes there either way.
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.
Description
Type of Change
Platform
Testing
Checklist
Related Issues
Closes #
Screenshots/Videos