Skip to content

Commit

Permalink
fix: 修复了启动agent服务检测环境时,如果项目路径或者相关依赖路径名称存在空格报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Coder-Huangzejia committed Sep 12, 2024
1 parent ca62705 commit f829f8d
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 f829f8d

Please sign in to comment.