in shardingsphere-benchmark/src/main/java/org/apache/shardingsphere/benchmark/common/file/util/ProcessUtil.java [62:85]
public static String getLinuxProcess(String processName) {
BufferedReader reader = null;
try {
Process process = Runtime.getRuntime().exec("ps -ef | grep " + processName);
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null) {
if (line.contains(processName)) {
String[] strs = line.split("\\s+");
return strs[1];
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) { }
}
}
return null;
}