Skip to content

Commit 42540f4

Browse files
authored
fix: zsh shell integration when sudo and ssh aliases are defined (ghostty-org#11185)
I encountered an issue related to ghostty-org#8641 and ghostty-org#8647, but in `zsh` instead of `bash`. One of my aliases is: ```bash alias sudo='sudo ' ``` Which causes following error when sourcing the zsh shell integrations: ```shell source /usr/share/ghostty/shell-integration/zsh/ghostty-integration /usr/share/ghostty/shell-integration/zsh/ghostty-integration:149: defining function based on alias `sudo' /usr/share/ghostty/shell-integration/zsh/ghostty-integration:233: parse error near `()' ```
2 parents dd575c7 + e07aefa commit 42540f4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/shell-integration/zsh/ghostty-integration

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ _ghostty_deferred_init() {
268268
# Sudo
269269
if [[ "$GHOSTTY_SHELL_FEATURES" == *"sudo"* ]] && [[ -n "$TERMINFO" ]]; then
270270
# Wrap `sudo` command to ensure Ghostty terminfo is preserved
271-
sudo() {
271+
function sudo() {
272272
builtin local sudo_has_sudoedit_flags="no"
273273
for arg in "$@"; do
274274
# Check if argument is '-e' or '--edit' (sudoedit flags)
@@ -291,7 +291,7 @@ _ghostty_deferred_init() {
291291

292292
# SSH Integration
293293
if [[ "$GHOSTTY_SHELL_FEATURES" == *ssh-* ]]; then
294-
ssh() {
294+
function ssh() {
295295
emulate -L zsh
296296
setopt local_options no_glob_subst
297297

0 commit comments

Comments
 (0)