[agent][executor]- bug - 2
This commit is contained in:
@@ -211,6 +211,10 @@ public class CommandExecutor {
|
||||
.commandLine()
|
||||
.get()
|
||||
);
|
||||
|
||||
// 对线程进行debug
|
||||
commandExecLogCache.debugProcessStreams(process);
|
||||
|
||||
process.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,42 @@ public class CommandExecLogCache {
|
||||
return execLogCacheArrayList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试打印process哥各个 流
|
||||
*
|
||||
* @param process
|
||||
*/
|
||||
public void debugProcessStreams(Process process) {
|
||||
|
||||
log.debug(
|
||||
"开始对一个process进行debug操作,process的信息为 {}, 执行时间为 {} , 执行结果为 {}",
|
||||
process
|
||||
.info()
|
||||
.commandLine(),
|
||||
process
|
||||
.info()
|
||||
.totalCpuDuration()
|
||||
.get(),
|
||||
process.exitValue()
|
||||
);
|
||||
|
||||
log.debug("------------- inputStream -----------");
|
||||
new BufferedReader(new InputStreamReader(process.getInputStream()))
|
||||
.lines()
|
||||
.forEach(
|
||||
System.out::println
|
||||
);
|
||||
|
||||
|
||||
log.debug("------------- errorStream -----------");
|
||||
new BufferedReader(new InputStreamReader(process.getErrorStream()))
|
||||
.lines()
|
||||
.forEach(
|
||||
System.out::println
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 实际执行命令缓存操作
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user