Amazon-ssm-agent: Ctlr+c in session manager produces unexpected behavior

Created on 11 Jan 2019  路  6Comments  路  Source: aws/amazon-ssm-agent

Hello! When I ctrl+c while in a session manager session, the macOS agent starts doing weird stuff and spits out both the remote command prompt and my local command prompt. I would expect the session manager agent to capture the ctrl+c and send it to the remote host, which would stop the process running in that shell. Can I make a request for that feature or am I doing something wrong? Regardless, what's the best way to stop a process running in the shell of a session manager session? Thank you!

Most helpful comment

@johnplaydrums How did you solve it, myself and a few colleagues are having the same problem, we're not even using the same terminal program (colleague is using Terminal.app and I'm using iTerm 2)

All 6 comments

Thank you for the feedback! We were not able to reproduce the issue and was hoping you can help us understand the repro steps better. To start with, which terminal and what versions of aws-cli, session-manager-plugin and ssm-agent are you using for this scenario? Is this a consistent repro in your setup?

Ah shoot, sorry to waste your time I realized this is an issue on our side and not a problem with ssm. Thank you for the help! :disappear:

@johnplaydrums How did you solve it, myself and a few colleagues are having the same problem, we're not even using the same terminal program (colleague is using Terminal.app and I'm using iTerm 2)

@jfharden Hey, I was having issues because we wrap the aws ssm start-session call in a python script, and the python script was having trouble handling ctrl+c correctly. Once I used the command directly (aws ssm start-session) it handled ctrl+c just fine. Are you wrapping the aws cli call in a script or anything?

@johnplaydrums Brilliant! Thank you. I'm using https://github.com/mmmorris1975/aws-runas to get the correct credentials and it seems this is the cause for us. If I run it as

# aws-runas myaccount aws ssm start-session --target i-123456789`

when I ctrl+c it goes crazy (exactly as you describe), but if I

# $(aws-runas myaccount)
# aws ssm start-session --target i-123456789

then everything is fine.

Yeah makes sense. You could add functionality to the aws-runas tool to better support ctrl+c, but I鈥檇 recommend just running it as you did in your second example. Cheers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arnaudmm picture arnaudmm  路  4Comments

thedevopsmachine picture thedevopsmachine  路  4Comments

evanstoddard23 picture evanstoddard23  路  4Comments

johnnyplaydrums picture johnnyplaydrums  路  5Comments

heydonovan picture heydonovan  路  3Comments