feat(可回溯): 视频生成
修改命令执行方式
This commit is contained in:
+18
-2
@@ -113,7 +113,7 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
||||
bw.flush();
|
||||
bw.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.directory(tempDir.toFile());
|
||||
// 在临时目录下执行命令
|
||||
@@ -136,8 +136,24 @@ public class RecallOrderApiServiceImpl implements RecallOrderApiService {
|
||||
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");
|
||||
if (file.exists()) {
|
||||
log.info(String.valueOf(file.length()));
|
||||
|
||||
Reference in New Issue
Block a user