Fix CMDER_ROOT validation and optimize cmder.sh/cmder_exinit#3044
Fix CMDER_ROOT validation and optimize cmder.sh/cmder_exinit#3044
Conversation
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
|
@copilot If CMDER_ROOT is not set in the .sh script, and we weren't able to find it using ConEmu, we can find the root based on the parent directory of the script (which is likely in This is important because in an GitHub actions CI environment, the CMDER_ROOT variable might not be defined unless we explicitly do so in the The .sh scripts must be able to follow other shell profiles and find the CMDER_ROOT the same way they do |
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
Added fallback to detect CMDER_ROOT from script location (vendor directory → parent) in commit b254bad, similar to how PowerShell profile does it. Detection hierarchy:
For This now works in GitHub Actions CI without explicit CMDER_ROOT configuration. |
Fixed critical path errors when
$CMDER_ROOTis unset and silentcpfailures when default template is missing. Optimized both shell scripts with proper validation, documentation, and bash-idiomatic conventions. Added automatic CMDER_ROOT detection from script location for CI environments.Core Fixes
/config/user_profile.shuser_profile.sh.defaultwhen it exists, preventing silent cp failurescmder_user_profile_pathassignment until after CMDER_ROOT validationCMDER_ROOT Detection Hierarchy
Scripts now use a three-tier detection approach:
$CMDER_ROOTenvironment variable$ConEmuDir(when running in ConEmu/Cmder)${BASH_SOURCE[0]}(vendor directory → parent = root)This ensures scripts work in CI environments (like GitHub Actions) without requiring explicit CMDER_ROOT configuration in
.ymlfiles.Code Quality
run_profile_d()and major sectionsrunProfiled→run_profile_d,CmderUserProfilePath→cmder_user_profile_pathsedinvocation with bash parameter expansion (${CMDER_ROOT%/})Why tests.yml Doesn't Fail on cp Errors
Bash continues after command failures without
set -e. Exit code reflects the last command (a successfulifstatement), not intermediate failures. Our validation prevents the error condition entirely.Files changed:
vendor/cmder.sh: 100 → 136 linesvendor/cmder_exinit: 114 → 153 linesOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.