Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing to call mvn or gradle at MAVEN_HOME, GRADLE_HOME respectively in Windows (Resolves #975) #998

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

facewise
Copy link
Contributor

There were two major factors causing this bug.

  1. Calling System.getenv() on initializing enums was failed on Windows.
  2. Getting the standard output of the process using oshi.util.ExecutingCommand.runNative() was failed on Windows due to Linux-specific command scripts.

Changes

  1. Changed the time calling System.getenv() after initializing.
  2. Set OS specific command scripts checking installation using com.sun.jna.Platform.isWindows().

Since com.sun.jna.Platform sets the static values of current OS on start, no needed to call System.getProperty("os.name") again.
But considered that the dependency including com.sun.jna.Platform may be removed in future, it could be the best option to check by calling System.getProperty("os.name").

@facewise facewise changed the title Fix failing to call mvn or gradle at MAVEN_HOME, GRADLE_HOME respectively in Windows(#975) Fix failing to call mvn or gradle at MAVEN_HOME, GRADLE_HOME respectively in Windows (Resolves #975) Jan 16, 2024
@imbyungjun
Copy link
Contributor

@facewise

When I install maven and gradle in Windows env, there are executable binary files each.

maven

  • mvn
  • mvn.cmd

gradle

  • gradle
  • gradle.bat

So, the original check command that using mvn and gradle works fine for me.
I don't understand why the check command for Windows needs to be changed.
Actually, I don't use Windows that much. Let me know if there is a reason the check command should be change.

@facewise
Copy link
Contributor Author

@imbyungjun

Please see #975 .

As you can see, running check command line like gradle -version on Windows cmd works fine.
But it seems that running command via the method named oshi.util.ExecutingCommand.runNative doesn't.

@imbyungjun
Copy link
Contributor

@facewise

Thanks, The issue only occurred when running the command using oshi.

I have successfully reproduced the issue and confirmed that it is resolved in your PR.
Thanks again for your contribution to nGrinder.

@imbyungjun imbyungjun merged commit add38d8 into naver:develop Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants