ayaports/user/dotnet6-build/sdk_telemetry-optout.patch

32 lines
1.1 KiB
Diff

From eb7141ec561b9a2551d16ee661343b87c5e5f1b1 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Sun, 23 Jan 2022 15:47:27 +0000
Subject: [PATCH 1/1] SDK telemetry optout
Disables telemetry by default.
---
src/Cli/dotnet/Program.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/sdk/src/Cli/dotnet/Program.cs b/src/sdk/src/Cli/dotnet/Program.cs
index c3be733b4a..2a157a75d5 100644
--- a/src/sdk/src/Cli/dotnet/Program.cs
+++ b/src/sdk/src/Cli/dotnet/Program.cs
@@ -27,6 +27,13 @@ public class Program
public static int Main(string[] args)
{
+ // opt out of telemetry by default if the env var is unset
+ string telemetryValue = Environment.GetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT");
+ if (String.IsNullOrEmpty(telemetryValue))
+ {
+ Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
+ }
+
DebugHelper.HandleDebugSwitch(ref args);
// Capture the current timestamp to calculate the host overhead.
--
2.35.1