azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

[Core] cli should have a centralized interactive input() function that checks if STDIN is a TTY

Open djyou opened this issue 10 years ago • 6 comments

Username: ERROR: EOF when reading a line
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/azure/cli/main.py", line 33, in main
    cmd_result = APPLICATION.execute(args)
  File "/usr/local/lib/python3.5/site-packages/azure/cli/core/application.py", line 139, in execute
    result = expanded_arg.func(params)
  File "/usr/local/lib/python3.5/site-packages/azure/cli/core/commands/__init__.py", line 274, in _execute_command
    result = op(client, **kwargs) if client else op(**kwargs)
  File "/usr/local/lib/python3.5/site-packages/azure/cli/command_modules/acr/repository.py", line 78, in acr_repository_list
    return _validate_user_credentials(registry_name, path, 'repositories', username, password)
  File "/usr/local/lib/python3.5/site-packages/azure/cli/command_modules/acr/repository.py", line 67, in _validate_user_credentials
    username = user_input("Username: ")
EOFError: EOF when reading a line

djyou avatar Nov 16 '16 20:11 djyou

As requested by @ahmetalpbalkan

djyou avatar Nov 16 '16 20:11 djyou

How's this different than #1348?

ahmetb avatar Nov 16 '16 20:11 ahmetb

Also it's not ACR specific I believe. azure-cli should have a centralized interactive input() function that checks if STDIN is a TTY and if not, it should return a nicer error (instead of a stack trace).

ahmetb avatar Nov 16 '16 20:11 ahmetb

https://github.com/Azure/azure-cli/issues/1349 is to track the issue in our command module or azure-cli in general, https://github.com/Azure/azure-cli/pull/1348 is the PR to fix our command module.

djyou avatar Nov 16 '16 20:11 djyou

ah you can add [ACR] prefix to issue to disambiguate.

ahmetb avatar Nov 16 '16 21:11 ahmetb

We should find all uses of input() and getpass() and guard these calls by checking if tty is available.

See _prompting.py in the core module for where this change should go.

derekbekoe avatar Jan 18 '17 21:01 derekbekoe