|
@@ -4,10 +4,7 @@ import cn.hutool.core.io.file.FileReader;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import java.io.BufferedReader;
|
|
|
-import java.io.Closeable;
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStreamReader;
|
|
|
+import java.io.*;
|
|
|
import java.net.URL;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
@@ -15,6 +12,27 @@ import java.nio.charset.StandardCharsets;
|
|
|
public class ShellUtil {
|
|
|
|
|
|
public final static String LAS_TO_BIN = "bash /home/ubuntu/bin/PotreeConverter.sh @inPath @outPath ''";
|
|
|
+
|
|
|
+
|
|
|
+ public static void execDockerCmd(String cmd){
|
|
|
+ log.info("execDockerCmd:{}",cmd);
|
|
|
+ ProcessBuilder processBuilder = new ProcessBuilder(cmd);
|
|
|
+ Process process;
|
|
|
+ try {
|
|
|
+ process = processBuilder.start();
|
|
|
+ BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
|
|
+ String line;
|
|
|
+ System.out.println("Output is: ");
|
|
|
+ while ((line = br.readLine()) != null) {
|
|
|
+ System.out.println(line);
|
|
|
+ }
|
|
|
+ process.waitFor();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("execDockerCmd:{},error:{}",cmd,e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 执行系统命令, 返回执行结果
|
|
|
* @param cmd 需要执行的命令
|