Skip to content

Commit

Permalink
[vcpkg] Fix incorrect handling of messages for permenantly disabled m…
Browse files Browse the repository at this point in the history
…etrics. (microsoft#15636)

Fixes microsoft#15630
  • Loading branch information
BillyONeal authored Jan 14, 2021
1 parent fd67439 commit 3f3d9a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ try {
throw "Environment variable did not disable metrics."
}

# Also test that you get no message without --sendmetrics
$vcpkgOutput = Run-Vcpkg list
if ($vcpkgOutput -contains $metricsAreDisabledMessage) {
throw "Disabled metrics emit message even without --sendmetrics"
}

if (-Not (Test-Metrics-Enabled '--no-disable-metrics')) {
throw "Environment variable to disable metrics could not be overridden by switch."
}
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int main(const int argc, const char* const* const argv)
metrics->set_send_metrics(*p);
}

if (args.send_metrics.value_or(true) && !metrics->metrics_enabled())
if (args.send_metrics.value_or(false) && !metrics->metrics_enabled())
{
System::print2(System::Color::warning, "Warning: passed --sendmetrics, but metrics are disabled.\n");
}
Expand Down

0 comments on commit 3f3d9a6

Please sign in to comment.