Skip to content

Make ex a Windows-aware function instead of an alias (#125)#191

Open
chrisdebian wants to merge 5 commits into
LandRegistry:developfrom
chrisdebian:fix-ex-alias-windows-gitbash
Open

Make ex a Windows-aware function instead of an alias (#125)#191
chrisdebian wants to merge 5 commits into
LandRegistry:developfrom
chrisdebian:fix-ex-alias-windows-gitbash

Conversation

@chrisdebian

Copy link
Copy Markdown

Closes #125.

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 — docker exec -it also needs winpty there, as already handled by the existing bashin() function.

This replaces the ex alias with a function (since aliases can't branch on a condition) that mirrors bashin's existing OS check: 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, since it's now a function.

Testing: I don't have a Windows machine to test the winpty path directly (the issue itself notes this needs someone with Windows access) — the Windows branch is a straight port of bashin's existing, presumably-working pattern, so the risk there is low. I did verify on Linux that ex resolves to the function and correctly forwards to docker exec after sourcing add-aliases.sh, and that remove-aliases.sh correctly unsets it afterwards (falls back to the system /usr/bin/ex editor).

sichapman and others added 5 commits March 6, 2026 10:09
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants