Open akinomyoga opened 3 months ago
I can confirm that the issue exists. See https://github.com/cantino/mcfly/issues/435 for more information.
The issue is crucial because I have to use Mcfly instead of Warp's built-in command search due to #4964.
Hi folks, unfortunately, Warp doesn't fully support PROMPT_COMMAND
in bash right now, to set a custom prompt use PS1
. That being said, Ive been able to reproduce this issue and will let the team know. We'll post updates on this thread.
What is the current status of this problem? As included in the initial report, this problem should be fixed by the following one line change in the code fetched to Bash:
if [[ -n $PROMPT_COMMAND && "$(declare -p PROMPT_COMMAND)" =~ "declare -a" ]]; then - PROMPT_COMMAND_FLATTENED=$(IFS="; "; echo "${PROMPT_COMMAND[*]}") + PROMPT_COMMAND_FLATTENED=$(IFS=$'\n'; echo "${PROMPT_COMMAND[*]}") unset PROMPT_COMMAND PROMPT_COMMAND=$PROMPT_COMMAND_FLATTENED fi
Ive been able to reproduce this issue and will let the team know.
Have you already let the team know? Does the team have access to GitHub? If not, could you let them know about the above suggested patch?
Dupe Check
Describe the bug
The bug happens in Bash. Bash 5.1 started to support the array version of
PROMPT_COMMAND
, where each element would be executed before showing a prompt. When an element of the arrayPROMPT_COMMAND
(that is not the last element in the array) ends with;
or&
after the initialization in~/.bashrc
, a syntax error arises.This is caused by the following part of Warp's shell integration:
The problem lies in the line calculating
PROMPT_COMMAND_FLATTENED
. In shell language, commands cannot be always joined by;
. For examplecmd1 &
andcmd2
(which are both valid commands) cannot be combined to becmd1 & ; cmd2
.cmd1 & ; cmd2
is a syntax error. Similarly,cmd1 ;
andcmd2
cannot be combined to becmd1 ;; cmd2
norcmd1 ; ; cmd2
. To join valid commands, a newline character should be used. Here, I suggest the following change:To reproduce
With the following single-line
~/.bashrc
, start Warp Terminal with Bash.Then, the following error message appears:
Expected behavior
The messages
foo
andbar
are printed before every new prompt.Screenshots
No response
Operating system
Linux
Operating system and version
KDE neon 6.0 x86_64
Shell Version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Current Warp version
warp-terminal-v0.2024.08.06.08.01.stable_00-1-x86_64
Regression
No, this bug or issue has existed throughout my experience using Warp
Recent working Warp date
No response
Additional context
No response
Does this block you from using Warp daily?
No
Is this an issue only in Warp?
Yes, I confirmed that this only happens in Warp, not other terminals.
Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e
None