You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/01/09 14:59:01 UTC

[GitHub] [flink] GJL commented on a change in pull request #10804: [FLINK-15488] Obtain the JVM and TM param correctly

GJL commented on a change in pull request #10804: [FLINK-15488] Obtain the JVM and TM param correctly
URL: https://github.com/apache/flink/pull/10804#discussion_r364782558
 
 

 ##########
 File path: flink-dist/src/main/flink-bin/bin/config.sh
 ##########
 @@ -605,26 +605,36 @@ runBashJavaUtilsCmd() {
     local cmd=$1
     local class_path=$2
     local conf_dir=$3
+    local EXECUTION_PREFIX="BASH_JAVA_UTILS_EXEC_RESULT:"
 
-    local output="`${JAVA_RUN} -classpath ${class_path} org.apache.flink.runtime.util.BashJavaUtils ${cmd} --configDir ${conf_dir} 2> /dev/null`"
+    local output=`${JAVA_RUN} -classpath ${class_path} org.apache.flink.runtime.util.BashJavaUtils ${cmd} --configDir ${conf_dir} | tail -n 1`
     if [[ $? -ne 0 ]]; then
-        echo "[ERROR] Cannot run BashJavaUtils to execute command ${cmd}."
+        echo "[ERROR] Cannot run BashJavaUtils to execute command ${cmd}." 1>&2
+        # Print the output in case the user redirect the log to console.
+        echo $output 1>&2
         exit 1
     fi
 
-    echo ${output}
+    if ! [[ $output =~ ^${EXECUTION_PREFIX}.* ]]; then
+        echo "[ERROR] Unexpected result: $output" 1>&2
+        echo "[ERROR] The last line of the BashJavaUtils outputs is expected to be the execution result, following the prefix '${EXECUTION_PREFIX}'" 1>&2
 
 Review comment:
   Maybe a bit shorter:
   ```
   Expected last line in BashJavaUtils output to be the execution result, following the prefix '${EXECUTION_PREFIX}'
   ```
   Also note the singular _output_.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services