Fix AWS CLI installation logic in check_awscli()#22
Conversation
📝 WalkthroughWalkthroughThis PR modifies ChangesScript control flow improvements
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Issue
The
check_awscli()function usedexit 1when AWS CLI was not installed.Since the function is invoked as:
check_awscli || install_awsclicalling
exit 1terminates the entire script beforeinstall_awscli()can be executed.Fix
Replaced:
exit 1with:
return 1This allows the function to return a failure status to the caller while preserving the intended control flow.
Why not
return 0?In shell scripting, a return value of
0indicates success.If
check_awscli()returns0when AWS CLI is not installed, the shell interprets the check as successful and the right-hand side of:check_awscli || install_awscliwill never execute.
Returning
1correctly indicates failure and triggersinstall_awscli()through the||operator.Result
install_awscli()is executed.