Skip to content

interp: different behavior of pipefail for multiline scripts #870

Closed
@Hades32

Description

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions