Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
djyou opened this issue Nov 16, 2016 · 6 comments
Labels
Core CLI core infrastructure

Comments

@djyou
Copy link
Member

djyou commented Nov 16, 2016

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
Copy link
Member Author

djyou commented Nov 16, 2016

As requested by @ahmetalpbalkan

@ahmetb
Copy link
Contributor

ahmetb commented Nov 16, 2016

How's this different than #1348?

@ahmetb
Copy link
Contributor

ahmetb commented Nov 16, 2016

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).

@djyou
Copy link
Member Author

djyou commented Nov 16, 2016

#1349 is to track the issue in our command module or azure-cli in general, #1348 is the PR to fix our command module.

@ahmetb
Copy link
Contributor

ahmetb commented Nov 16, 2016

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

@djyou djyou changed the title Add some is tty check to fail early if STDIN isn't a tty acr repository list: add is_tty check to fail early if STDIN isn't a tty Nov 16, 2016
@djyou djyou changed the title acr repository list: add is_tty check to fail early if STDIN isn't a tty [Core/ACR] Add tty check to fail early if STDIN isn't a tty Dec 12, 2016
@derekbekoe derekbekoe added the Core CLI core infrastructure label Jan 18, 2017
@derekbekoe derekbekoe changed the title [Core/ACR] Add tty check to fail early if STDIN isn't a tty [Core] cli should have a centralized interactive input() function that checks if STDIN is a TTY Jan 18, 2017
@derekbekoe
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core CLI core infrastructure
Projects
None yet
Development

No branches or pull requests

5 participants