Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch: standard exit code #779

Merged
merged 1 commit into from
Nov 3, 2024
Merged

Commits on Nov 3, 2024

  1. patch: standard exit code

    * Patch::error() returns $ERROR
    * In Patch::print_rejects(), $ERROR is incremented if rejected pieces are found during processing
    * No other function updates $ERROR, so Patch::error() indicates if rejects are present
    * die() cals are wrapped by an END-block which sets exit code to 1; follow standard and set it to 2 [1]
    * Failure to detect a diff in the input is considered an error; call die() to indicate this
    * test1: "perl patch -x" ---> bad option, exit(2)
    * test2: "echo "BOGUS-DIFF-123" > bogus.diff && perl patch xargs bogus.diff" ---> no diff found, exit(2)
    * test3: "perl patch dirname sort.diff" ---> mismatched diff which can't be applied, exit(1)
    * test4: "perl patch a.c correct.diff" ---> diff applies with no failed parts, exit(0)
    
    1. https://pubs.opengroup.org/onlinepubs/007904975/utilities/patch.html
    mknos authored Nov 3, 2024
    Configuration menu
    Copy the full SHA
    f4f74f6 View commit details
    Browse the repository at this point in the history