zhilinli123 commented on code in PR #6735:
URL: https://github.com/apache/seatunnel/pull/6735#discussion_r1574054363


##########
seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/FlinkStarter.java:
##########
@@ -52,8 +54,46 @@ public static void main(String[] args) {
     @Override
     public List<String> buildCommands() {
         List<String> command = new ArrayList<>();
+        String local_os_type = "";
+
+        SystemUtil my_system_util = new SystemUtil();
+        local_os_type = my_system_util.GetOsType();
+        // debug
+        // System.out.println("OS type:"+local_os_type);
+
+        String cmd_flink = "";
+
+        /* Nothe that "flink.cmd” or "flink.bat" can be retrieved from
+           lower version of flink (e.g.1.0.9),We do not check if this
+           file exists on the box, user needs to make sure this file
+           exists or not.
+        */
+        switch (local_os_type.toLowerCase()) {
+            case "windows":
+                cmd_flink = "%FLINK_HOME%/bin/flink.bat";
+                break;
+            case "linux":
+                cmd_flink = "${FLINK_HOME}/bin/flink";
+                break;
+            case "solaris":
+                cmd_flink = "${FLINK_HOME}/bin/flink";
+                break;
+            case "mac":
+                cmd_flink = "${FLINK_HOME}/bin/flink";
+                break;
+            case "unknown":
+                cmd_flink = "error";
+                break;
+        }
+
         // set start command
-        command.add("${FLINK_HOME}/bin/flink");
+        if (!(cmd_flink.equals("error"))) {
+            command.add(cmd_flink);
+        } else {
+            System.out.println("Error: Can not determine OS type, abort run 
!");
+            System.exit(-1);

Review Comment:
   System.exit(-1) is not recommended. The code causes some strange security 
problems; Throw an exception if there is a problem
   



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