From 580920ef63929ad60bea835bf043483f314db0dc Mon Sep 17 00:00:00 2001 From: tryag <40431305+Notryag@users.noreply.github.com> Date: Sun, 29 Mar 2026 21:38:29 +0800 Subject: [PATCH] fix: use Git Bash for Windows local startup (#1551) * fix: use Git Bash for Windows local startup * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Willem Jiang Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- Makefile | 6 ++---- scripts/run-with-git-bash.cmd | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 scripts/run-with-git-bash.cmd diff --git a/Makefile b/Makefile index 8833dd0d7..550e7cd41 100644 --- a/Makefile +++ b/Makefile @@ -97,8 +97,7 @@ setup-sandbox: # Start all services in development mode (with hot-reloading) dev: ifeq ($(OS),Windows_NT) - @echo "Detected Windows - using Git Bash..." - @$(BASH) ./scripts/serve.sh --dev + @call scripts\run-with-git-bash.cmd ./scripts/serve.sh --dev else @./scripts/serve.sh --dev endif @@ -106,8 +105,7 @@ endif # Start all services in production mode (with optimizations) start: ifeq ($(OS),Windows_NT) - @echo "Detected Windows - using Git Bash..." - @$(BASH) ./scripts/serve.sh --prod + @call scripts\run-with-git-bash.cmd ./scripts/serve.sh --prod else @./scripts/serve.sh --prod endif diff --git a/scripts/run-with-git-bash.cmd b/scripts/run-with-git-bash.cmd new file mode 100644 index 000000000..8692ca337 --- /dev/null +++ b/scripts/run-with-git-bash.cmd @@ -0,0 +1,20 @@ +@echo off +setlocal + +set "bash_exe=" + +for /f "delims=" %%I in ('where git 2^>NUL') do ( + if exist "%%~dpI..\bin\bash.exe" ( + set "bash_exe=%%~dpI..\bin\bash.exe" + goto :found_bash + ) +) + +echo Could not locate Git for Windows Bash ("..\bin\bash.exe" relative to git on PATH). Ensure Git for Windows is installed and that git and bash.exe are available on PATH. +exit /b 1 + +:found_bash +echo Detected Windows - using Git Bash... +"%bash_exe%" %* +set "cmd_rc=%ERRORLEVEL%" +exit /b %cmd_rc%