Fix silent script failure on Windows (Git Bash / MINGW)#320
Fix silent script failure on Windows (Git Bash / MINGW)#320w3spi5 wants to merge 1 commit intobuildermethods:mainfrom
Conversation
|
Hi @CasJam, I noticed PR #317 by @Perlover addresses the same arithmetic exit code issue. Their approach uses pre-increment ((++var)) instead of my ((var++)) || true — both work, but theirs is cleaner. However, my PR includes additional fixes that #317 doesn't cover:
These additions specifically address Windows compatibility issues that caused the script to fail silently (see discussion #311). Suggestion: You could merge #317 first (simpler fix), then cherry-pick my CRLF/retry additions. Or I can update my PR to use ((++var)) instead of || true if you prefer a single merged solution. Let me know what works best! |
|
@CasJam, have you seen PR on your project ? wake up please, we are waiting for this correction. I have to modify all my dev env on all machines, please correct asap |
|
If you manually copy the scripts (instead of git clone), you may get "Permission denied" errors when running them. Root cause: Unix execute permissions (+x) are not preserved when copying files between Windows (NTFS) and Linux/WSL2 filesystems. Quick fix: This fixed my issue on my desktop (WSL2 Ubuntu) where the scripts worked fine on my laptop but failed with "permission denied" on my fixed PC. |
Problem
The installation script silently exits after displaying "Configuration:" when run on Windows with Git Bash / MINGW. No error message is shown, making debugging very difficult.
Root Causes
((count++))return exit code 1 when the variable is 0 (because 0 is "false" in bash). Combined withset -e, this silently terminates the scriptSolution
1. Auto-fix CRLF on Windows
Added detection and automatic conversion of CRLF to LF when running on MINGW/MSYS. The script converts all
.shand.ymlfiles, then restarts itself.2. Retry mechanism
If the script fails for any reason, it automatically retries without strict mode (
set -e), allowing it to complete and show any errors.3. Safe arithmetic expressions
Added
|| trueto all((var++))expressions to prevent them from triggeringset -ewhen the variable is 0.4. .gitattributes
Added
.gitattributesto enforce LF line endings for future clones.Files Changed
scripts/project-install.sh- Added CRLF fix, retry mechanism, and safe arithmetic.gitattributes- New file to enforce LF line endingsTesting
Tested on Windows 11 with Git Bash (MINGW64). Script now completes successfully on first run.