Skip to content

Commit

Permalink
Eliminate escape codes in aws_ssm output from newer versions of Bash (#…
Browse files Browse the repository at this point in the history
…1839)

SUMMARY

aws_ssm - prevent escape codes from interfering with output

Fixes #1756

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

aws_ssm

ADDITIONAL INFORMATION

This disables the Readline feature enable-bracketed-paste which is enabled by default on Bash 5.1 and above. This was causing escape sequences like \x1b[?2004h\x1b[?2004l to get into the output from some operating systems (e.g. Amazon Linux).

(cherry picked from commit af18bc6)
  • Loading branch information
dennisjlee authored and patchback[bot] committed Jan 3, 2024
1 parent f96afea commit ec96a41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/1839-disable-bracketed-paste.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- aws_ssm - disable `enable-bracketed-paste` to fix issue with amazon linux 2023 and other OSes (https://github.com/ansible-collections/community.aws/issues/1756)
2 changes: 1 addition & 1 deletion plugins/connection/aws_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def _prepare_terminal(self):
disable_prompt_complete = None
end_mark = "".join([random.choice(string.ascii_letters) for i in xrange(self.MARK_LENGTH)])
disable_prompt_cmd = to_bytes(
"PS1='' ; printf '\\n%s\\n' '" + end_mark + "'\n",
"PS1='' ; bind 'set enable-bracketed-paste off'; printf '\\n%s\\n' '" + end_mark + "'\n",
errors="surrogate_or_strict",
)
disable_prompt_reply = re.compile(r"\r\r\n" + re.escape(end_mark) + r"\r\r\n", re.MULTILINE)
Expand Down

0 comments on commit ec96a41

Please sign in to comment.