Skip to content

Commit

Permalink
Set DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT environment variable whe…
Browse files Browse the repository at this point in the history
…n exec'ing upgrade-assistant (#3)
  • Loading branch information
bryceatmoderne authored Sep 27, 2024
1 parent 9052bfb commit 8f0f0d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/main/java/org/openrewrite/dotnet/UpgradeAssistantRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ protected void execUpgradeAssistant(Path inputFile, Accumulator acc, ExecutionCo
}
processOutput(inputFile, out, acc);
}
} catch (
IOException e) {
} catch (IOException e) {
throw new UncheckedIOException(e);
} catch (
InterruptedException e) {
} catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
deleteFile(out);
Expand All @@ -147,6 +145,7 @@ protected void execUpgradeAssistant(Path inputFile, Accumulator acc, ExecutionCo
private Map<String, String> buildUpgradeAssistantEnv() {
Map<String, String> env = new HashMap<>();
env.put("TERM", "dumb");
env.put("DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT", "1");
String path = System.getenv("PATH");
// This is required to find .NET SDKs
env.put("PATH", path + File.pathSeparator + DOTNET_HOME);
Expand All @@ -157,8 +156,8 @@ protected void deleteFile(@Nullable Path path) {
if (path != null) {
try {
Files.deleteIfExists(path);
} catch (IOException e) {
// FIXME recipe logger?
} catch (IOException ignored) {
// Ignored
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/rewrite/category.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

---
type: specs.openrewrite.org/v1beta/category
name: .Net
name: .NET
packageName: org.openrewrite.dotnet
description: Recipes to migrate projects using .NET tools.
---

0 comments on commit 8f0f0d8

Please sign in to comment.