SbloodyS commented on code in PR #11334:
URL: https://github.com/apache/dolphinscheduler/pull/11334#discussion_r940817591


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/ShellCommandExecutor.java:
##########
@@ -85,39 +85,37 @@ protected void createCommandFileIfNotExists(String 
execCommand, String commandFi
         logger.info("tenantCode user:{}, task dir:{}", 
taskRequest.getTenantCode(),
                 taskRequest.getTaskAppId());
 
-        // create if non existence
-        if (!Files.exists(Paths.get(commandFile))) {
-            logger.info("create command file:{}", commandFile);
-
-            StringBuilder sb = new StringBuilder();
-            if (SystemUtils.IS_OS_WINDOWS) {
-                sb.append("@echo off\n");
-                sb.append("cd /d %~dp0\n");
-                if 
(!Strings.isNullOrEmpty(taskRequest.getEnvironmentConfig())) {
-                    sb.append(taskRequest.getEnvironmentConfig()).append("\n");
-                } else {
-                    if (taskRequest.getEnvFile() != null) {
-                        sb.append("call 
").append(taskRequest.getEnvFile()).append("\n");
-                    }
-                }
-            } else {
-                sb.append("#!/bin/sh\n");
-                sb.append("BASEDIR=$(cd `dirname $0`; pwd)\n");
-                sb.append("cd $BASEDIR\n");
-                if 
(!Strings.isNullOrEmpty(taskRequest.getEnvironmentConfig())) {
-                    sb.append(taskRequest.getEnvironmentConfig()).append("\n");
-                } else {
-                    if (taskRequest.getEnvFile() != null) {
-                        sb.append("source 
").append(taskRequest.getEnvFile()).append("\n");
-                    }
-                }
-            }
-            sb.append(execCommand);
-            logger.info("command : {}", sb);
-
-            // write data to file
-            FileUtils.writeStringToFile(new File(commandFile), sb.toString(), 
StandardCharsets.UTF_8);
+        if (Files.exists(Paths.get(commandFile))) {
+            return;

Review Comment:
   This does not realize what the comments says in 
https://github.com/apache/dolphinscheduler/issues/10562#issuecomment-1175877731



-- 
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