Browse Source

[Improvement][Worker] Kill task error(#5199) (#5212)

pull/3/MERGE
wenjun 3 years ago committed by GitHub
parent
commit
4a1303b625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java

9
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java

@ -409,7 +409,7 @@ public class ProcessUtils {
* @throws Exception exception * @throws Exception exception
*/ */
public static String getPidsStr(int processId) throws Exception { public static String getPidsStr(int processId) throws Exception {
StringBuilder sb = new StringBuilder(); List<String> pidList = new ArrayList<>();
Matcher mat = null; Matcher mat = null;
// pstree pid get sub pids // pstree pid get sub pids
if (OSUtils.isMacOS()) { if (OSUtils.isMacOS()) {
@ -424,11 +424,14 @@ public class ProcessUtils {
if (null != mat) { if (null != mat) {
while (mat.find()) { while (mat.find()) {
sb.append(mat.group(1)).append(" "); pidList.add(mat.group(1));
} }
} }
return sb.toString().trim(); if (CommonUtils.isSudoEnable() && !pidList.isEmpty()) {
pidList = pidList.subList(1, pidList.size());
}
return String.join(" ", pidList).trim();
} }
/** /**

Loading…
Cancel
Save