Make ex a Windows-aware function instead of an alias (#125)#191
Open
chrisdebian wants to merge 5 commits into
Open
Make ex a Windows-aware function instead of an alias (#125)#191chrisdebian wants to merge 5 commits into
chrisdebian wants to merge 5 commits into
Conversation
Fix autoupdate
ex was a plain alias for "\$DC_CMD exec", which on Windows / Git Bash invokes a vi terminal instead of running the command in the container, and docker exec -it needs winpty there anyway. Replace it with a function alongside bashin (which already does the same OS check) that uses winpty $DC_CMD exec on Windows/Git Bash/ Cygwin and $DC_CMD exec otherwise. Updated remove-aliases.sh to unset -f ex instead of unalias ex.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #125.
exwas a plain alias for$DC_CMD exec, which on Windows / Git Bash invokes a vi terminal instead of running the command in the container —docker exec -italso needswinptythere, as already handled by the existingbashin()function.This replaces the
exalias with a function (since aliases can't branch on a condition) that mirrorsbashin's existing OS check: useswinpty $DC_CMD exec "$@"on Windows/Git Bash/Cygwin, and$DC_CMD exec "$@"otherwise. Updatedremove-aliases.shtounset -f exinstead ofunalias ex, since it's now a function.Testing: I don't have a Windows machine to test the
winptypath directly (the issue itself notes this needs someone with Windows access) — the Windows branch is a straight port ofbashin's existing, presumably-working pattern, so the risk there is low. I did verify on Linux thatexresolves to the function and correctly forwards todocker execafter sourcingadd-aliases.sh, and thatremove-aliases.shcorrectly unsets it afterwards (falls back to the system/usr/bin/exeditor).