From 12fb058fb5cb10cc85af6e813ea0c8747db3be06 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Tue, 27 Aug 2024 20:38:18 -0500 Subject: [PATCH] Possible fix for issue on osx (#1338) I believe OSX was unhappy with the empty string in the list, while ubuntu and windows were okay with it. Also added logic to make sure if the command fails the plugin doesn't try to split null. closes #1336 --- Src/CSharpier.Rider/.prettierrc.yaml | 2 +- Src/CSharpier.Rider/CHANGELOG.md | 3 +++ Src/CSharpier.Rider/gradle.properties | 2 +- .../com/intellij/csharpier/CSharpierProcessProvider.java | 8 ++++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Src/CSharpier.Rider/.prettierrc.yaml b/Src/CSharpier.Rider/.prettierrc.yaml index 49842610b..706caa8d1 100644 --- a/Src/CSharpier.Rider/.prettierrc.yaml +++ b/Src/CSharpier.Rider/.prettierrc.yaml @@ -1,4 +1,4 @@ printWidth: 100 tabWidth: 4 plugins: - - prettier-plugin-java \ No newline at end of file + - prettier-plugin-java diff --git a/Src/CSharpier.Rider/CHANGELOG.md b/Src/CSharpier.Rider/CHANGELOG.md index f8f8a10f2..7dbacfd61 100644 --- a/Src/CSharpier.Rider/CHANGELOG.md +++ b/Src/CSharpier.Rider/CHANGELOG.md @@ -2,6 +2,9 @@ # csharpier-rider Changelog +## [1.8.1] +- Possible fix for issue with OSX not being able to run dotnet tool list command + ## [1.8.0] - Use dotnet tool list to find both local and global installs of csharpier. diff --git a/Src/CSharpier.Rider/gradle.properties b/Src/CSharpier.Rider/gradle.properties index 2aebc438d..ef8c121af 100644 --- a/Src/CSharpier.Rider/gradle.properties +++ b/Src/CSharpier.Rider/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = com.intellij.csharpier pluginName = csharpier -pluginVersion = 1.8.0 +pluginVersion = 1.8.1 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. diff --git a/Src/CSharpier.Rider/src/main/java/com/intellij/csharpier/CSharpierProcessProvider.java b/Src/CSharpier.Rider/src/main/java/com/intellij/csharpier/CSharpierProcessProvider.java index 94842cc86..0d6a9d473 100644 --- a/Src/CSharpier.Rider/src/main/java/com/intellij/csharpier/CSharpierProcessProvider.java +++ b/Src/CSharpier.Rider/src/main/java/com/intellij/csharpier/CSharpierProcessProvider.java @@ -141,7 +141,7 @@ private String findCSharpierVersionInToolOutput( String directoryThatContainsFile, boolean isGlobal ) { - var command = List.of("tool", "list", (isGlobal ? "-g" : "")); + var command = isGlobal ? List.of("tool", "list", "-g") : List.of("tool", "list"); var output = DotNetProvider.getInstance(this.project).execDotNet( command, new File(directoryThatContainsFile) @@ -149,9 +149,13 @@ private String findCSharpierVersionInToolOutput( this.logger.debug( "Running 'dotnet tool list" + (isGlobal ? "-g" : "") + "' to look for version" - ); + ); this.logger.debug("Output was: \n " + output); + if (output == null) { + return null; + } + var lines = Arrays.stream(output.split("\n")) .map(String::trim) .filter(line -> !line.isEmpty())