[agent][executor]- bug - 8

This commit is contained in:
zeaslity
2023-02-26 10:59:40 +08:00
parent e92792ccc4
commit 86bfe8877f
2 changed files with 27 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@@ -227,7 +228,32 @@ public class CommandExecutor {
throw new RuntimeException(e);
}
process.destroy();
//process.destroy();
try {
byte[] bytes = process
.getInputStream()
.readAllBytes();
String s = new String(
bytes,
StandardCharsets.UTF_8
);
log.debug(
"从process中获取到的 所有字符内容为 {}",
s
);
// 关闭这个命令执行的inputStream
process
.getInputStream()
.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
Process exitProcess = process

View File

@@ -54,7 +54,6 @@ public class CommandExecLogCache {
process
);
}