脚本执行返回
This commit is contained in:
@@ -65,16 +65,16 @@ public class AsyncCommandExecutor {
|
|||||||
// 异步读取输出
|
// 异步读取输出
|
||||||
Process finalProcess = process;
|
Process finalProcess = process;
|
||||||
Future<String> outputFuture = executorService.submit(() -> {
|
Future<String> outputFuture = executorService.submit(() -> {
|
||||||
// StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
String output = "";
|
// String output = "";
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(finalProcess.getInputStream()))) {
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(finalProcess.getInputStream()))) {
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
// output.append(line).append("\n");
|
output.append(line).append("\n");
|
||||||
output = line;
|
// output = line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 设置超时
|
// 设置超时
|
||||||
|
|||||||
Reference in New Issue
Block a user