DevonianTeuchter / meta

Meta repository to tie together the various underlying z/OS Open Source tools repositories here
https://zosopentools.github.io/meta/
Apache License 2.0
2 stars 0 forks source link

fix for print elapsed time exit issue #39

Closed HarithaIBM closed 1 year ago

HarithaIBM commented 1 year ago

This fixes closes - https://github.com/DevonianTeuchter/meta/issues/28

DevonianTeuchter commented 1 year ago

Wonder if there is a difference in the return code from set -x running from bash or sh [since it's a builtin] perhaps?

In any case, is the modified code being driven from printElapsedTime as it still appears to be commented out in common.inc so the change in printVerbose would not be called?

...
printElapsedTime()
{
  printType=$1
  functionName=$2
  startTime=$3
  elapsedTime=$(( $SECONDS - $startTime ))
  elapsedTimeOutput="$functionName completed in $elapsedTime seconds."
#  case $printType in
#    "info")
#      printInfo "$elapsedTimeOutput"
#      ;;
#    "verbose")
#      printVerbose "$elapsedTimeOutput"
#      ;;
#  esac
}
...

Would it also be worth adding the explicit return 0 to the printInfo and printWarning functions for consistency and prevent this odd issue?

HarithaIBM commented 1 year ago

Wonder if there is a difference in the return code from set -x running from bash or sh [since it's a builtin] perhaps?

In any case, is the modified code being driven from printElapsedTime as it still appears to be commented out in common.inc so the change in printVerbose would not be called?

...
printElapsedTime()
{
  printType=$1
  functionName=$2
  startTime=$3
  elapsedTime=$(( $SECONDS - $startTime ))
  elapsedTimeOutput="$functionName completed in $elapsedTime seconds."
#  case $printType in
#    "info")
#      printInfo "$elapsedTimeOutput"
#      ;;
#    "verbose")
#      printVerbose "$elapsedTimeOutput"
#      ;;
#  esac
}
...

Would it also be worth adding the explicit return 0 to the printInfo and printWarning functions for consistency and prevent this odd issue?

Yes, added it there as well.

HarithaIBM commented 1 year ago

Looks good to me as [ ! -z "$xtrc" ] && set -x is returning non-zero, maybe we can investigate why at a later time.

Yes sure, raised https://github.com/DevonianTeuchter/meta/issues/50 to track it