String[] cmd = {"/bin/sh", "-c", "ps -ef |grep " + s };//s是参数,进程名
Process proc = Runtime.getRuntime().exec(cmd);
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
if ((line = br.readLine()) == null) {
XxlJobLogger.log("执行出错");
log.info("执行出错");
return new ReturnT<>(ReturnT.FAIL_CODE,"执行出错");
} else {
int count=0;
do {
XxlJobLogger.log(s + ":" + line);
count++;
} while ((line = br.readLine()) != null);
}
br.close();
在linux上同样的命令会打印出进程的具体信息包括pid,command等,但该程序执行后只能打印出个数,请问是哪里错了吗,该怎么写