njnu-seafish commented on code in PR #17320:
URL: 
https://github.com/apache/dolphinscheduler/pull/17320#discussion_r2206085730


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ProcessUtils.java:
##########
@@ -100,29 +113,39 @@ public static boolean kill(@NonNull TaskExecutionContext 
request) {
 
             // Get all child processes
             String pids = getPidsStr(processId);
-            String[] pidArray = pids.split("\\s+");
+            String[] pidArray = PID_PATTERN.split(pids);
             if (pidArray.length == 0) {
                 log.warn("No valid PIDs found for process: {}", processId);
                 return true;
             }
 
+            // Convert PID string to list of integers
+            List<Integer> pidList = new ArrayList<>();
+            for (String pidStr : pidArray) {
+                try {
+                    pidList.add(Integer.parseInt(pidStr));
+                } catch (NumberFormatException e) {
+                    log.warn("Invalid PID: {}", pidStr);

Review Comment:
   // Convert PID string to list of integers
               List<Integer> pidList = new ArrayList<>();
               for (String pidStr : pidArray) {
                   pidList.add(Integer.parseInt(pidStr));
               }                
   The outer try-catch block will capture and handle the exception.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to