Exit CD when fail for a variety of reasons#34128
Conversation
|
@jaykishanmutkawoa thanks for this submission! We do not normally accept contributions to the build scripts. However, I will check in the triage meeting if this is something we would want to change. Just a reminder to please sign the CLA to have your submission considered for a potential merge. Thanks! |
|
Hi @jaykishanmutkawoa, if you sign the CLA we are willing to merge this change. Thanks! |
49bea2c to
f21d34a
Compare
done.. thanks |
crw
left a comment
There was a problem hiding this comment.
LGTM, after conversation with @liamcervante
|
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
|
@jaykishanmutkawoa Are you using this script in your Terraform workflow? |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
cdcan fail for a variety of reasons: misspelled paths, missing directories, missing permissions, broken symlinks and more.If/when it does, the script will keep going and do all its operations in the wrong directory. This can be messy, especially if the operations involve creating or deleting a lot of files. To avoid this, make sure you handle the cases when cd fails. Ways to do this include:
cd foo || exitas suggested to abort immediately, using exit code from failed cd command