Skip to content

Add set -o pipefail to all bin scripts #127

@remenoscodes

Description

@remenoscodes

The Quality Gates workflow enforces pipefail in all bin scripts, but adding it naively breaks pipes that use | head due to SIGPIPE (exit 141).

Requires a careful refactor:

  1. Switch shebang from #\!/bin/sh to #\!/usr/bin/env bash (pipefail is not POSIX)
  2. Add set -o pipefail after set -e in all 20 executable scripts
  3. Handle SIGPIPE in all | head, | sed ... | head, and similar truncating pipelines
  4. Options: trap '' PIPE, || true on specific pipes, or restructure to avoid early-exit readers

Affected pipelines (examples):

  • git log ... | sed | head -1 in git-issue-show (state extraction)
  • git for-each-ref ... | awk | sort in git-issue-ls
  • Similar patterns in most bin scripts (6,301 total lines, 400+ pipe usages)

Attempted quick fix (shebang + pipefail) caused exit 141 across core tests. Reverted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions