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

set -euf -o pipefail #47

Merged
merged 1 commit into from
Jan 5, 2018
Merged

set -euf -o pipefail #47

merged 1 commit into from
Jan 5, 2018

Conversation

davidchambers
Copy link
Owner

set -euf -o pipefail is equivalent to:

set -o errexit      # Exit immediately if a command exits with a non-zero status.

set -o nounset      # Treat unset variables as an error when substituting.

set -o noglob       # Disable file name generation (globbing).

set -o pipefail     # The return value of a pipeline is the status of
                    # the last command to exit with a non-zero status,
                    # or zero if no command exited with a non-zero status.

We already have errexit enabled. ShellCheck asserts statically what nounset checks at run time, so this option should be safe to enable. We don't currently use any globbing or piping, so enabling noglob and pipefail should not change the behaviour of the program.

xyz
@@ -220,7 +220,7 @@ run npm prune
run npm test

for script in "${scripts[@]}" ; do
[[ $script == /* ]] || script="$(pwd)/$script"
[[ $script =~ ^/ ]] || script="$(pwd)/$script"
Copy link
Owner Author

Choose a reason for hiding this comment

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

Although this change is not necessary, using =~ is consistent with the way in which matching is performed elsewhere in the program ([[ $increment =~ ^pre ]], for example).

@davidchambers
Copy link
Owner Author

I have not yet merged this pull request due to concern that this change could affect the behaviour of scripts provided via --script. Since opening the pull request I have determined that changes to shell options are not inherited, so I'm now ready to merge.

@davidchambers davidchambers merged commit 8201d69 into master Jan 5, 2018
@davidchambers davidchambers deleted the strict branch January 5, 2018 14:26
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.

None yet

1 participant