From 6d7964caeca5b2f15789dc09556654ff9f55207b Mon Sep 17 00:00:00 2001 From: meriadec Date: Fri, 13 Jul 2018 09:33:42 +0200 Subject: [PATCH] Improve var scoping in runJob --- scripts/helpers/run-job.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/helpers/run-job.sh b/scripts/helpers/run-job.sh index 2631b240..89b03f4b 100644 --- a/scripts/helpers/run-job.sh +++ b/scripts/helpers/run-job.sh @@ -4,22 +4,27 @@ source scripts/helpers/format.sh operatingSystem=$(uname -s) -if [ "$operatingSystem" != Linux* ] && [ "$operatingSystem" != Darwin* ]; then +if [ "$operatingSystem" != "Linux" ] && [ "$operatingSystem" != "Darwin" ]; then operatingSystem="Windows" fi function runJob { - job=$1 - progressMsg=$2 - successMsg=$3 - errMsg=$4 - logLevel=$5 + local job=$1 + local progressMsg=$2 + local successMsg=$3 + local errMsg=$4 + local logLevel=$5 + + local tmpScript + local tmpErrFile + local childPid + local returnCode # let's absolutely don't take care of this fake os if [ "$operatingSystem" == "Windows" ]; then - local tmpScript=$(mktemp) - echo $job > "$tmpScript" + tmpScript=$(mktemp) + echo "$job" > "$tmpScript" bash "$tmpScript" rm "$tmpScript" return $?