naver / ngrinder

enterprise level performance testing solution
naver.github.io/ngrinder
Apache License 2.0
1.96k stars 473 forks source link

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

Closed facewise closed 4 months ago

facewise commented 5 months ago

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").

imbyungjun commented 4 months ago

@facewise

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

maven

gradle

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 commented 4 months ago

@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 commented 4 months ago

@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.