feat(可回溯): 视频生成
修改命令执行方式
This commit is contained in:
+18
-2
@@ -113,7 +113,7 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
|||||||
bw.flush();
|
bw.flush();
|
||||||
bw.close();
|
bw.close();
|
||||||
fw.close();
|
fw.close();
|
||||||
String[] command = {"ts-node", " /opt/rrvideo/src/cli.ts --input traces.json"};
|
/*String[] command = {"ts-node", " /opt/rrvideo/src/cli.ts --input traces.json"};
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||||
processBuilder.directory(tempDir.toFile());
|
processBuilder.directory(tempDir.toFile());
|
||||||
// 在临时目录下执行命令
|
// 在临时目录下执行命令
|
||||||
@@ -136,8 +136,24 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
processThread.start();
|
processThread.start();*/
|
||||||
|
try {
|
||||||
|
String[] cmd = {"ts-node", "/opt/rrvideo/src/cli.ts", "--input traces.json"};
|
||||||
|
Process process = Runtime.getRuntime().exec(cmd);
|
||||||
|
|
||||||
|
// 捕获输出
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
String line;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
System.out.println(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待进程结束
|
||||||
|
int exitCode = process.waitFor();
|
||||||
|
System.out.println("Command exited with code " + exitCode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
File file = new File(tempDir.toFile(), "video.mp4");
|
File file = new File(tempDir.toFile(), "video.mp4");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
log.info(String.valueOf(file.length()));
|
log.info(String.valueOf(file.length()));
|
||||||
|
|||||||
Reference in New Issue
Block a user