Skip to content

fix: resolve Windows Git Bash setup and startup compatibility issues#1630

Merged
utksh1 merged 1 commit into
utksh1:mainfrom
omnipotentchaos:fix/windows-git-bash-compat
Jul 5, 2026
Merged

fix: resolve Windows Git Bash setup and startup compatibility issues#1630
utksh1 merged 1 commit into
utksh1:mainfrom
omnipotentchaos:fix/windows-git-bash-compat

Conversation

@omnipotentchaos

Copy link
Copy Markdown
Contributor

Summary

This PR resolves the compatibility issues encountered when setting up, running, and testing the SecuScan development environment natively on Windows via Git Bash (MINGW64).

Closes #1531

Changes Done

  1. Dynamic Virtualenv Resolution (setup.sh, start.sh, testing/test_python.sh):
    • Added logic to dynamically check for both venv/Scripts (Windows) and venv/bin (Linux/macOS) layout.
    • Sourced the correct Unix-compatible shell activate script in Git Bash.
  2. Cross-Platform Port Cleanup (start.sh):
    • Replaced direct lsof calls with a fallback chain checking for netstat and taskkill on Windows.
    • Appended || true to the pipeline commands to prevent set -euo pipefail from exiting when no processes are listening on ports 8000/5173.
  3. Portable Python Executable Invocation:
    • Changed calls to run python instead of python3 inside the virtual environment because Windows venvs only generate python.exe.
  4. Instruction Updates (frontend/start.sh):
    • Updated CLI advice to suggest using python instead of python3.

Verification Details

  • Verified that all scripts cleanly fallback and resolve correct virtual environment paths.
  • Verified that Git Bash correctly runs the setup, dev server, and test suites natively on Windows.

Copilot AI review requested due to automatic review settings July 4, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR targets developer-experience parity for running SecuScan natively on Windows via Git Bash by making the setup/start/test shell scripts resilient to Windows venv layouts and missing Unix-only tooling.

Changes:

  • Detect and source the correct virtualenv activation path (venv/Scripts vs venv/bin) across scripts.
  • Add a Windows-friendly port cleanup fallback in start.sh when lsof is unavailable.
  • Standardize runtime invocation inside venvs to use python (instead of python3) and update frontend guidance text accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
testing/test_python.sh Adds Windows venv Scripts/ path handling for selecting venv python and activating the venv.
start.sh Adds lsof/netstat+taskkill port cleanup fallback and Windows venv activation; adjusts interpreter usage.
setup.sh Adds Windows venv Scripts/ activation and venv-python selection logic; updates manual-start instructions.
frontend/start.sh Updates the printed backend-start instruction to use python instead of python3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread start.sh
Comment thread start.sh Outdated
Comment on lines +59 to +65
# Determine python command
PYTHON_CMD="python3"
if ! command -v python3 &>/dev/null && command -v python &>/dev/null; then
if python -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 11) else 1)' &>/dev/null; then
PYTHON_CMD="python"
fi
fi
Comment thread setup.sh
Comment on lines +133 to +145
if [ -d "venv/Scripts" ]; then
VENV_BIN="venv/Scripts"
else
VENV_BIN="venv/bin"
fi

if [ -x "$VENV_BIN/python3" ]; then
VENV_PYTHON="$VENV_BIN/python3"
elif [ -x "$VENV_BIN/python" ]; then
VENV_PYTHON="$VENV_BIN/python"
else
VENV_PYTHON="$VENV_BIN/python3"
fi
Comment thread testing/test_python.sh
Comment on lines +37 to +49
if [ -d "$VENV_DIR/Scripts" ]; then
VENV_BIN_DIR="$VENV_DIR/Scripts"
else
VENV_BIN_DIR="$VENV_DIR/bin"
fi

if [ -x "$VENV_BIN_DIR/python3" ]; then
VENV_PYTHON="$VENV_BIN_DIR/python3"
elif [ -x "$VENV_BIN_DIR/python" ]; then
VENV_PYTHON="$VENV_BIN_DIR/python"
else
VENV_PYTHON="$VENV_BIN_DIR/python3"
fi
@omnipotentchaos
omnipotentchaos force-pushed the fix/windows-git-bash-compat branch from 6946229 to 0fe7b9d Compare July 4, 2026 15:16
@utksh1
utksh1 merged commit 35f07ec into utksh1:main Jul 5, 2026
21 checks passed
@utksh1 utksh1 added gssoc:approved Admin validation: approved for GSSoC scoring level:intermediate 35 pts difficulty label for moderate contributor PRs type:bug Bug fix work category bonus label area:backend Backend API, database, or service work labels Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work gssoc:approved Admin validation: approved for GSSoC scoring level:intermediate 35 pts difficulty label for moderate contributor PRs type:bug Bug fix work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] : Local setup, startup, and testing shell scripts fail on Windows Git Bash (MINGW64)

3 participants