azagrebin commented on a change in pull request #11545:
URL: https://github.com/apache/flink/pull/11545#discussion_r411240284



##########
File path: flink-dist/src/main/flink-bin/bin/config.sh
##########
@@ -633,16 +633,29 @@ runBashJavaUtilsCmd() {
     echo "$output"
 }
 
-extractExecutionParams() {
-    local execution_config=$1
+extractExecutionResults() {
+    local output="$1"
+    local expected_lines="$2"
     local EXECUTION_PREFIX="BASH_JAVA_UTILS_EXEC_RESULT:"
+    local execution_results
 
-    if ! [[ $execution_config =~ ^${EXECUTION_PREFIX}.* ]]; then
-        echo "[ERROR] Unexpected result: $execution_config" 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
+    IFS=$'\n' execution_results=($(echo "${output}" | grep 
${EXECUTION_PREFIX}))
+    if [[ ${#execution_results[@]} != ${expected_lines} ]]; then
+        echo "[ERROR] The execution results has unexpected number of lines, 
expected: ${expected_lines}, actual: ${#execution_results[@]}." 1>&2
+        echo "[ERROR] An execution result line is expected following the 
prefix '${EXECUTION_PREFIX}'" 1>&2

Review comment:
       Looks like, we have to rebase this part on master because of 
[FLINK-17023](https://issues.apache.org/jira/browse/FLINK-17023). Btw, `wc -l` 
solution there for counting lines looks a bit simpler.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to