-
Notifications
You must be signed in to change notification settings - Fork 252
Fix windows script #279
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
base: main
Are you sure you want to change the base?
Fix windows script #279
Conversation
Warning Rate limit exceeded@yuvikaaaaaa has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 12 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThe changes update Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant script.sh
participant OS
Note over script.sh: Start: print OSTYPE
User->>script.sh: run
script.sh->>OS: detect $OSTYPE
alt python3 available
script.sh->>OS: python3 -m venv venv
else fallback
script.sh->>OS: python -m venv venv
end
alt Windows-like (msys* / cygwin* / win32)
script.sh->>OS: source venv/Scripts/activate
else Unix-like
script.sh->>OS: source venv/bin/activate
end
script.sh->>OS: curl -L -o <archive> <url>
script.sh->>OS: deactivate (guarded)
Note over script.sh: End
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
backend/script.sh (1)
1-2
: Add strict-mode guards at the top of the script
set -euo pipefail
(or at leastset -e
) will abort the script on the first failing command, preventing the rest of the logic (e.g.,deactivate
) from being executed in a half-configured environment.#!/bin/bash + +# Abort on error, undefined var, or failed pipeline +set -euo pipefail
🧹 Nitpick comments (3)
backend/script.sh (2)
15-19
: Pattern matching is fragile; simplify OS detectionQuoting the RHS while appending
*
works, but it is easy to get wrong and fails in POSIX/bin/sh
. Since the script already requires Bash, prefer:-if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "cygwin"* || "$OSTYPE" == "win32" ]]; then +case "$OSTYPE" in + msys*|cygwin*|win32*) source venv/Scripts/activate -else + ;; + *) source venv/bin/activate -fi + ;; +esacThis is shorter, more idiomatic, and avoids subtle quoting pitfalls.
25-27
: Consider--fail
and output file naming forcurl
Adding
--fail
turns HTTP errors into non-zero exit codes that stop the script underset -e
.- curl -L $S2V_URL -o $S2V_ARCHIVE + curl -fL $S2V_URL -o "$S2V_ARCHIVE"Also quote variables to protect paths containing spaces.
README.md (1)
46-51
: Minor wording & consistency tweaks for the Windows note
- Replace “If using Git Bash:” with “When running in Git Bash:” to read more naturally.
- Clarify that the script already falls back to
curl
, so the user doesn’t have to do anything.-### 🪟 Windows Users -If using Git Bash: +### 🪟 Windows Users +When running in Git Bash: - Replace `python3` with `python` if needed. - Use `source venv/Scripts/activate` instead of `source venv/bin/activate`. - - If `wget` is not available, `curl -L -o` is used in script. + - No action needed if `wget` is missing — the script automatically uses `curl -L`.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
README.md
(1 hunks)backend/script.sh
(1 hunks)
🔇 Additional comments (1)
backend/script.sh (1)
11-13
: Usecommand -v
for more reliable Python fallback
python3 -m venv venv || python -m venv venv
only triggers the fallback if the first command exits non-zero. On some systemspython3
may exist but point to Python 2 or havevenv
missing, returning exit 0 while still doing the wrong thing. A safer pattern:-if [ ! -d "venv" ]; then - python3 -m venv venv || python -m venv venv -fi +if [ ! -d "venv" ]; then + if command -v python3 >/dev/null 2>&1; then + python3 -m venv venv + else + python -m venv venv + fi +fiLikely an incorrect or invalid review comment.
Fixes #256
Enhanced script.sh for Windows compatibility:
curl
in place ofwget
source deactivate
withdeactivate
python
ifpython3
not availableSummary by CodeRabbit
Documentation
Chores