Skip to content

Conversation

@marten-seemann
Copy link
Contributor

cc @mvdan

@marten-seemann marten-seemann requested a review from Stebalien May 13, 2021 16:42
Copy link

@mvdan mvdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, can you not just use $? directly in the if check?

@marten-seemann
Copy link
Contributor Author

I tried that earlier and it didn't work. I tried again and now it works :(
Will update the PR.

pushd $dir > /dev/null
set +e -x
s=0
(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: you can also say:

if ! (
${{ inputs.run }}
); then
status = ...

I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it great that there are 20 different ways to do the easiest things in bash?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works, but we'd lose the exit status.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Yeah, that makes sense.

Isn't it great that there are 20 different ways to do the easiest things in bash?

Hm. That's way too few. We should switch everything to Perl.

@marten-seemann marten-seemann merged commit 344272c into master May 13, 2021
@marten-seemann marten-seemann deleted the improve-bash-piping branch July 23, 2021 18:28
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 this pull request may close these issues.

4 participants