Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctor: Split version str with .lines() to account for Windows' \r\n #130

Merged
merged 1 commit into from
Aug 26, 2023

Conversation

MarijnS95
Copy link
Member

Excerpt from #116 (comment)

On Windows at least adb prints it version string with carriage return; leaving the \r in there (by only splitting on \n) and not trimming the string causes us to print its version with a \r at the end, clearing the whole line (i.e. it would print adb 1.0.41\r followed by the path, and then only the path remains on this line).

Rust's .lines() implementation already takes care of this by splitting (inclusively) on \n and trimming off that \n and optionally also a \r in the iterator before returning it to us.

On Windows at least `adb` prints it version string with carriage return;
leaving the `\r` in there (by only splitting on `\n`) and not trimming
the string causes us to print its version with a `\r` at the end,
clearing the whole line (i.e. it would print `adb     1.0.41\r` followed
by the path, and then only the path remains on this line).

Rust's `.lines()` implementation already takes care of this by splitting
(inclusively) on `\n` and trimming off that `\n` and _optionally also a
`\r`_ in the iterator before returning it to us.
@MarijnS95 MarijnS95 merged commit 0fe7e31 into master Aug 26, 2023
34 checks passed
@MarijnS95 MarijnS95 deleted the doctor-trim-carriage-return branch August 26, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants