wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.73k stars 749 forks source link

bash PROMPT_COMMAND syntax error #3171

Open atyrberg opened 1 year ago

atyrberg commented 1 year ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

Ubuntu 22.04.2 LTS Gnome 42.5 GNU bash, version 5.1.16(1)-release

WezTerm version

20230226-223328-0ac1cbc4

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

When using wezterm I get the following error message every time the prompt is shown:

-bash: PROMPT_COMMAND: line 2: syntax error near unexpected token `;'
-bash: PROMPT_COMMAND: line 2: `_direnv_hook; ; autojump_add_to_database'

I don't have this problem when running GNOME terminal.

The PROMPT_COMMAND environment variable is set to:

> echo $PROMPT_COMMAND
__bp_precmd_invoke_cmd _direnv_hook; ; autojump_add_to_database __bp_interactive_mode

Setting PROMPT_COMMAND environment variable to the value it is set to in GNOME-terminal seems to work: export PROMPT_COMMAND="_direnv_hook ; autojump_add_to_database"

To Reproduce

  1. Install and setup autojump and direnv. My setup in .bashrc is the following:

    source /usr/share/autojump/autojump.sh
    eval "$(direnv hook bash)"
  2. Start wezterm

  3. Press enter

Configuration

no config

Expected Behavior

The PROMPT_COMMAND works as in GNOME-terminal without needing to export PROMPT_COMMAND with another value.

Logs

No response

Anything else?

It seems like the Kitty terminal have had some similar problem, https://github.com/kovidgoyal/kitty/issues/4645. I don't know if this is related at all.

atyrberg commented 1 year ago

If I set the WEZTERM_SHELL_SKIP_ALL to 1 it seems like this issue doesn’t appear, so the issue might be related to the wezterm.sh-file.

I have also tried to only disable WEZTERM_SHELL_SKIP_SEMANTIC_ZONES, WEZTERM_SHELL_SKIP_CWD and WEZTERM_SHELL_SKIP_USER_VARS but that doesn’t help.