Fix silent script failure on Windows (Git Bash / MINGW) #320
+95
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.