Skip to content

Commit

Permalink
Merge pull request #465 from Coder-Huangzejia/fix-envcheck-error
Browse files Browse the repository at this point in the history
fix: 修复了在启动agent服务检测环境时,如果项目路径或者相关依赖路径名称存在空格,则会报错的问题
  • Loading branch information
ZhouYixun authored Sep 14, 2024
2 parents ca62705 + f829f8d commit 02a5667
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/cloud/sonic/agent/tools/EnvCheckTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private boolean checkADB() {
adb.setExecutable(true);
adb.setWritable(true);
adb.setReadable(true);
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("%s version", adb.getAbsolutePath()));
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("\"%s\" version", adb.getAbsolutePath()));
if (ver.size() == 0) {
printFail(type);
throw new RuntimeException("Can not use adb! Please ensure that `adb` command useful!" + (system.toUpperCase(Locale.ROOT).contains("MAC") ? " You can see " + HELP_URL + " ." : ""));
Expand All @@ -163,7 +163,7 @@ private boolean checkSAS() {
sasBinary.setExecutable(true);
sasBinary.setWritable(true);
sasBinary.setReadable(true);
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("%s version", sasBinary.getAbsolutePath()));
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("\"%s\" version", sasBinary.getAbsolutePath()));
sasPrintVersion = (ver.size() == 0 ? "null" : ver.get(0));
if (ver.size() == 0 || !BytesTool.versionCheck(sasVersion, ver.get(0))) {
printFail(type);
Expand All @@ -190,7 +190,7 @@ private boolean checkSIB() {
sibBinary.setExecutable(true);
sibBinary.setWritable(true);
sibBinary.setReadable(true);
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("%s version", sibBinary.getAbsolutePath()));
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("\"%s\" version", sibBinary.getAbsolutePath()));
sibPrintVersion = (ver.size() == 0 ? "null" : ver.get(0));
if (ver.size() == 0 || !BytesTool.versionCheck(sibVersion, ver.get(0))) {
printFail(type);
Expand All @@ -217,7 +217,7 @@ private boolean checkSGM() {
sgmBinary.setExecutable(true);
sgmBinary.setWritable(true);
sgmBinary.setReadable(true);
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("%s -version", sgmBinary.getAbsolutePath()));
List<String> ver = ProcessCommandTool.getProcessLocalCommand(String.format("\"%s\" -version", sgmBinary.getAbsolutePath()));
sgmPrintVersion = (ver.size() == 0 ? "null" : ver.get(0));
if (ver.size() == 0 || !BytesTool.versionCheck(sgmVersion, ver.get(0).replace("sonic-go-mitmproxy:", "").trim())) {
printFail(type);
Expand Down

0 comments on commit 02a5667

Please sign in to comment.