Bash integration: Fix clone-in-kitty not working on bash >= 5.2 if environment variable values contain newlines or other special characters

Bash >= 5.2 changed the export command to output values using $' escaping when they contain special characters.
Fixes #5629
This commit is contained in:
Kovid Goyal
2022-11-22 16:38:24 +05:30
parent 4fc91dcc03
commit 51bba9110e
5 changed files with 163 additions and 37 deletions

View File

@@ -332,7 +332,8 @@ _ksi_transmit_data() {
}
clone-in-kitty() {
builtin local data="shell=bash,pid=$$,cwd=$(builtin printf "%s" "$PWD" | builtin command base64),envfmt=bash,env=$(builtin export | builtin command base64)"
builtin local bv="${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]}.${BASH_VERSINFO[2]}"
builtin local data="shell=bash,pid=$$,bash_version=$bv,cwd=$(builtin printf "%s" "$PWD" | builtin command base64),envfmt=bash,env=$(builtin export | builtin command base64)"
while :; do
case "$1" in
"") break;;