(MODULES-4135) choco -v - Remove all extraneous messaging #52
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.
When determining the version of Chocolatey that is installed, the
module calls
choco -vwhich will return the version in most versionsof Chocolatey (anything earlier than 0.9.8.24 or more than 4 years old
may not). However sometimes there is messaging that tends to be
presented as warnings that still end up being included in the output.
Instead of looking for specific wording, typically the chocolatey
version is going to be the last line in the output. So remove all of
the other lines and just use the last line available.
Using a simpler
string.lines.lastis out because it only splitson
$/and doesn't allow multiple options. So split on CRLF, then LF,then CR. This allows the output to be evaluated on different
platforms and not be subject to whatever Ruby believes
$/evaluatesto on that platform.