Skip to content

Commit

Permalink
[FLINK-17023][scripts] Improve handling of unexpected input
Browse files Browse the repository at this point in the history
  • Loading branch information
tsreaper committed Apr 17, 2020
1 parent b7f16a4 commit 0c9ced4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions flink-dist/src/main/flink-bin/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,16 @@ extractExecutionParams() {
local execution_config=$1
local EXECUTION_PREFIX="BASH_JAVA_UTILS_EXEC_RESULT:"

if ! [[ $execution_config =~ ^${EXECUTION_PREFIX}.* ]]; then
local num_lines=$(echo "$execution_config" | wc -l)
if ! [[ ${num_lines} == 1 ]]; then
echo "[ERROR] Unexpected result ($num_lines lines): $execution_config" 1>&2
echo "[ERROR] extractExecutionParams only accepts exactly one line as the input" 1>&2
exit 1
fi

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
echo "$output" 1>&2
echo "[ERROR] The output of BashJavaUtils is expected to be the execution result, following the prefix '${EXECUTION_PREFIX}'" 1>&2
exit 1
fi

Expand Down

0 comments on commit 0c9ced4

Please sign in to comment.