This is an automated email from the ASF dual-hosted git repository.
leonbao pushed a commit to branch 1.3.6-prepare
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/1.3.6-prepare by this push:
new 5ec72aa [1.3.6-prepare][Improvement][Worker] Throw operation not
permitted exception when kill shell task (#5214)
5ec72aa is described below
commit 5ec72aa619d6a6f6770d6448db6e636d55d4c2a9
Author: Kirs <[email protected]>
AuthorDate: Tue Apr 6 11:17:44 2021 +0800
[1.3.6-prepare][Improvement][Worker] Throw operation not permitted
exception when kill shell task (#5214)
pr #5212
issue #5199
---
.../org/apache/dolphinscheduler/server/utils/ProcessUtils.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
index f09e317..4b36589 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
@@ -389,7 +389,7 @@ public class ProcessUtils {
* @throws Exception exception
*/
public static String getPidsStr(int processId) throws Exception {
- StringBuilder sb = new StringBuilder();
+ List<String> pidList = new ArrayList<>();
Matcher mat = null;
// pstree pid get sub pids
if (OSUtils.isMacOS()) {
@@ -404,11 +404,13 @@ public class ProcessUtils {
if (null != mat) {
while (mat.find()) {
- sb.append(mat.group(1)).append(" ");
+ pidList.add(mat.group(1));
}
}
-
- return sb.toString().trim();
+ if (!pidList.isEmpty()) {
+ pidList = pidList.subList(1, pidList.size());
+ }
+ return String.join(" ", pidList).trim();
}
/**