diff --git a/src/connectedvmware/HISTORY.rst b/src/connectedvmware/HISTORY.rst index ba2814abfcf..36eb438a002 100644 --- a/src/connectedvmware/HISTORY.rst +++ b/src/connectedvmware/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +1.2.1 +++++++ +* For pwinput, read input from stdin when tty is not available + 1.2.0 ++++++ * Add support to enable a VM using managed object name (moName). diff --git a/src/connectedvmware/azext_connectedvmware/pwinput.py b/src/connectedvmware/azext_connectedvmware/pwinput.py index b6003bb245a..1202958a0fd 100644 --- a/src/connectedvmware/azext_connectedvmware/pwinput.py +++ b/src/connectedvmware/azext_connectedvmware/pwinput.py @@ -34,7 +34,10 @@ except ImportError: pass # There is no typing module on Python 2, but that's fine because we use the comment-style of type hints. -if sys.platform == 'win32': +if not sys.stdin.isatty(): + def pwinput(prompt='Password: ', mask='*'): + return sys.stdin.readline().rstrip() +elif sys.platform == 'win32': # For some reason, mypy reports that msvcrt doesn't have getch, ignore this warning: from msvcrt import getch # type: ignore diff --git a/src/connectedvmware/setup.py b/src/connectedvmware/setup.py index 1501b876cca..7a6bfe764ed 100644 --- a/src/connectedvmware/setup.py +++ b/src/connectedvmware/setup.py @@ -19,7 +19,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '1.2.0' +VERSION = '1.2.1' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers