aws / aws/amazon-ssm-agent

`^C` should not unconditionally terminate the session.

Open
#483 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

Instead of sending `SIGINT` to the shell and terminating the current process (and providing a new prompt), `^C` unconditionally terminates the SSM session, even if `su - ` has been used, or if a process is in the foreground `tail -f /path/to/file`), or from within a nested shell. This behavior is unique to SSM sessions, so I imagine the agent is listening for `SIGINT` and terminating.... which is fairly cumbersome.

```
Starting session with SessionId: REDACTED
exec bash
sh-4.2$ exec bash
[ssm-user@ip-123 bin]$ stty -a
speed 38400 baud; rows 61; columns 240; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
[ssm-user@ip-123 bin]$ stty intr \^C
[ssm-user@ip-123 bin]$ ^C
[ssm-user@ip-123 bin]$

$ # now i'm back in my local prompt
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the SSM session behavior shown in the report, including nested shells, su, and a foreground tail -f process, then trace how the agent handles ^C and SIGINT. Done means ^C interrupts the foreground command or shell without unconditionally terminating the SSM session or returning to the local prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.