I've adopted their trick here (along with some other minor changes), and it solves my issue. I verified it by connecting to a remote EC2 shell and running:
tput lines
tput cols
These report updated values as expected when resizing the Terminal.app window. Also, running a TUI app such as vim and then resizing the window doesn't cause garbled output whereas without this patch it does.
Hello! I use the
ssm-session-client
code as a library to my own CLI tool.I've noticed that compared to the AWS official SSM client,
ssm-session-client
doesn't deal well with terminal resizing (this is using Terminal.app on macOS). I went digging a bit, and it seems AWS's client doesn't rely on getting aSIGWINCH
, but simply sends terminal size every 500ms: https://github.com/aws/session-manager-plugin/blob/65933d1adf368d1efde7380380a19a7a691340c1/src/sessionmanagerplugin/session/shellsession/shellsession.go#L98-L134I've adopted their trick here (along with some other minor changes), and it solves my issue. I verified it by connecting to a remote EC2 shell and running:
These report updated values as expected when resizing the Terminal.app window. Also, running a TUI app such as
vim
and then resizing the window doesn't cause garbled output whereas without this patch it does.