aws-sso-cli icon indicating copy to clipboard operation
aws-sso-cli copied to clipboard

`CTRL-C` in windows causes crash, loss of command history, garbled pasting.

Open AHoran opened this issue 1 year ago • 1 comments

AWS SSO CLI Version 1.9.2 -- Copyright 2021-2022 Aaron Turner
307f13eb377284001a3545ea1394c2303786925f (v1.9.2) built at 2022-05-13T17:07:59-0700

Describe the bug: In Windows when running a shell via aws-sso exec pwsh any usage of CTRL-C will cause major issues. aws-sso seems to remain running when you use exec, and the first usage of ctrl-c causes it to crash. Thereafter pasting text into the shell leads to garbled text, your command history has gone, and in some cases when selecting commands from history a different command is executed.

To Reproduce:

  1. Run powershell
  2. Enter exec mode aws-sso exec -p 1234:role pwsh.
  3. Confirm that you are now authenticated to AWS : aws sts get-caller-identity
  4. Start a long running command that you will CTRL-C from. gci c:\ -recurse . Let it run for several seconds and CTRL-C
  5. At this point your aws-sso process has died, but you can't see it.
  6. Now press up arrow key for your command history, note that it's probably aws-sso exec -p 1234:role pwsh. and not either of the other commands.
  7. aws sts get-caller-identity and you won't be authenticated any more.
  8. Copy some text from somewhere else and paste it in, it will become garbled.
  9. Running dir c:\ -recurse again and trying ctrl-c will no longer work as expected

Expected behavior:

  • Why does aws-sso need to still be running? Why does it need to intercept what's going to the shell?
  • ctrl-c shouldn't cause such serious follow on problems.

AHoran avatar Jul 21 '22 08:07 AHoran

this seems related to or a duplicate of #91. To answer your question of why aws-sso needs to still be running is because it is starting a child process (in your case pwsh) when using exec. That is "as designed" and intentional with exec. it's possible with your comment in #188 we can avoid this on windows via eval, but need to find a few free moments to give it a try.

synfinatic avatar Jul 21 '22 16:07 synfinatic