feat(可回溯): 可回溯
调整等待方式
This commit is contained in:
@@ -130,6 +130,9 @@ public class OrderController {
|
|||||||
processBuilder.directory(tempDir.toFile());
|
processBuilder.directory(tempDir.toFile());
|
||||||
// 在临时目录下执行命令
|
// 在临时目录下执行命令
|
||||||
Process process = processBuilder.start();
|
Process process = processBuilder.start();
|
||||||
|
|
||||||
|
Thread processThread = new Thread(() -> {
|
||||||
|
try {
|
||||||
// 读取命令输出
|
// 读取命令输出
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
String line;
|
String line;
|
||||||
@@ -137,11 +140,23 @@ public class OrderController {
|
|||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
|
|
||||||
// 等待命令执行完成
|
// 等待命令执行完成
|
||||||
int exitCode = process.waitFor();
|
int exitCode = process.waitFor();
|
||||||
|
|
||||||
System.out.println("Command exited with code " + exitCode);
|
System.out.println("Command exited with code " + exitCode);
|
||||||
|
} catch (InterruptedException | IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
processThread.start();
|
||||||
|
|
||||||
|
// Continue with other tasks here...
|
||||||
|
|
||||||
|
try {
|
||||||
|
processThread.join();
|
||||||
|
} catch (InterruptedException 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()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user