diff --git a/scripts/common/lib.sh b/scripts/common/lib.sh index c77b775..bc812ad 100755 --- a/scripts/common/lib.sh +++ b/scripts/common/lib.sh @@ -63,17 +63,18 @@ health_check() { # ----------------------------------------------------------------------------- git_commit() { - cd "$ROOT_DIR" || return 1 - git rev-parse --short HEAD 2>/dev/null || echo "unknown" + ( cd "$ROOT_DIR" && git rev-parse --short HEAD 2>/dev/null || echo "unknown" ) } git_dirty() { - cd "$ROOT_DIR" || return 1 - if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then - echo "dirty" - else - echo "clean" - fi + ( + cd "$ROOT_DIR" || exit 1 + if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then + echo "dirty" + else + echo "clean" + fi + ) } # ----------------------------------------------------------------------------- @@ -96,28 +97,34 @@ write_metadata_json() { mkdir -p "$(dirname "$output_path")" - cat > "$output_path" <