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

interp: different behavior of pipefail for multiline scripts #870

Closed
Hades32 opened this issue May 31, 2022 · 0 comments · Fixed by #990
Closed

interp: different behavior of pipefail for multiline scripts #870

Hades32 opened this issue May 31, 2022 · 0 comments · Fixed by #990

Comments

@Hades32
Copy link

Hades32 commented May 31, 2022

I'm using Task and hit this issue and was directed here: go-task/task#392 (comment)

I want my script to fail on pipe errors. cmd1 works/fails as expected, but cmd2 never fails:

  cmd1:
    cmds: 
    - set -o pipefail ; aws something | jq .someField
    - echo success # this never happens if aws fails

  cmd2:
    cmds: 
    - |
      set -e
      set -o pipefail
      aws something | jq .someField
      echo success # happens despite error in the aws command

Why does pipefail not work in the second case?

@mvdan mvdan changed the title Different behavior of pipefail for multiline scripts interp: different behavior of pipefail for multiline scripts Apr 16, 2023
mvdan added a commit that referenced this issue Apr 16, 2023
We supported both options separately,
but when used together, a command like

    false | true

would fail to exit the shell properly.

Add tests and fix the bug.

Fixes #870.
mvdan added a commit that referenced this issue Apr 17, 2023
We supported both options separately,
but when used together, a command like

    false | true

would fail to exit the shell properly.

Add tests and fix the bug.

Fixes #870.
diamondburned pushed a commit to diamondburned/mvdan-sh that referenced this issue May 9, 2023
We supported both options separately,
but when used together, a command like

    false | true

would fail to exit the shell properly.

Add tests and fix the bug.

Fixes mvdan#870.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant