Fix hang on invisible tty when using 2FA where prompt=terminal in some edge cases#1184
Fix hang on invisible tty when using 2FA where prompt=terminal in some edge cases#1184mtibben merged 2 commits into99designs:masterfrom
Conversation
|
Are there are any weird edge cases to this? Is it possible to have a terminal without a TTY these days? Does this work on Windows and other OSs? |
I am not able to find any, in fact this only fixes an edge case. This particular path is only prompted when Specifically: Running
I don't think so? I might be misunderstanding the question, but to my belief anything without a TTY cannot be considered a terminal. TTY's are essential for I/O and signalling. As The TTY demystified says though, "the TTY subsystem — while quite functional from a user's point of view — is a twisty little mess of special cases."
I don't have a Windows machine to test on. That said, this works on Macos and Linux machines and I can't imagine it not working in any terminal emulator. Again though, this only targets one particular flow where I've rebased my branch and fixed the linter error that I saw show up in the Github Actions. Thanks for your quick review so far! |
This implements the fix suggested by @ngyuki in #1054. When using
prompt=terminal(which we use to support both Linux and Mac using the same workflow and config, withoutosascriptinvolvement), we used to have a workaround in.aws/configthat would redirect the terminal prompt to stdout in most cases by adding2> $(tty)to the end of theaws-vaultcredential_processcall, like this:With this patch we can remove that redirect and the prompt always shows up, even when called through the SDK via
aws --profile somerole s3 ls, for example. Also removes the creation of spurious files namednot a ttywhenprompt=terminalis forced.This expands on #1149 a bit, where instead of just preferring a non-terminal prompt without an active tty it should show up in all cases anyway when specifically requested.