-
-
Notifications
You must be signed in to change notification settings - Fork 92
fix: utils script #894
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
fix: utils script #894
Conversation
PR SummaryUpdated the sourcing mechanism for the Changes
autogenerated by presubmit.ai |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 Pull request needs attention.
Review Summary
Commits Considered (11)
Files Processed (11)
- core/main/src/main/assets/terminal/init.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/bash.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/css.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/eslint.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/html.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/json.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/markdown.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/python.sh (1 hunk)
- core/main/src/main/assets/terminal/lsp/typescript.sh (1 hunk)
- core/main/src/main/assets/terminal/setup.sh (1 hunk)
- core/main/src/main/assets/terminal/universal_runner.sh (1 hunk)
Actionable Comments (2)
-
core/main/src/main/assets/terminal/init.sh [5-5]
possible bug: "Validate the
$PREFIXenvironment variable before use." -
core/main/src/main/assets/terminal/init.sh [5-5]
possible bug: "Verify existence of the utility script before sourcing."
Skipped Comments (0)
| shopt -s checkwinsize | ||
|
|
||
| source "$(dirname "$0")/utils" | ||
| source "$PREFIX/local/bin/utils" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script now relies on the $PREFIX environment variable. It's crucial to ensure that $PREFIX is always set correctly before this line. Consider adding a check like if [ -z "$PREFIX" ]; then echo "Error: PREFIX is not set. Cannot source utils script."; exit 1; fi before attempting to source the utils script to prevent runtime errors if the variable is missing or empty. This is especially important in init.sh as it does not have set -e at the top, meaning a failed source might not immediately stop execution.
| shopt -s checkwinsize | ||
|
|
||
| source "$(dirname "$0")/utils" | ||
| source "$PREFIX/local/bin/utils" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After ensuring $PREFIX is set, it's also a good practice to verify that the utils file actually exists at the specified absolute path ($PREFIX/local/bin/utils). If the file is missing, the source command will fail. Adding a check like if [ ! -f "$PREFIX/local/bin/utils" ]; then echo "Error: utils script not found at $PREFIX/local/bin/utils."; exit 1; fi would make the script more robust and provide a clearer error message. This applies to all scripts where the sourcing mechanism was changed.
No description provided.