aws / aws/session-manager-plugin

Terminal settings not restored after aws ecs execute-command

Open
#34 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
320
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Hi, I hope I've found the right place for this bug.

After running `aws ecs execute-command --interactive`, I loose handling of special characters for erase, werase, kill, eof, etc by the terminal. Running `stty icanon` is sufficient to get things working again.

I am using version 1.2.295.0 on linux.

I found it necessary to run a shell to reproduce this. Executing /bin/true did not reproduce the issue.

```bash
:; aws ecs execute-command --interactive ... --command /bin/bash

The Session Manager plugin was installed successfully. Use the AWS CLI to start a session.

Starting session with SessionId: ecs-execute-command-0ffda0a0ffda0a0ff
root@ip-1-2-3-4# exit

Exiting session with sessionId: ecs-execute-command-0ffda0a0ffda0a0ff.

:; cat # observe erase and eof not being processed, interrupt still works
^?^?^?^D^C
:; stty icanon
:; cat # observe handlng of special characters is restored
:;
```

The issue in this case was the `icanon` flag not being reset to it's previous state, but it's a good idea to capture the existing termios settings and restore them before exiting.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.