mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Check that stdin is a tty before reading
If stdin isn't a tty, the behaviour of std::getline(std::cin, email) and getpass() is different (the latter always uses /dev/tty). If input is redirected, it's probably best to just fail.
This commit is contained in:
parent
d9587e4544
commit
574a315c44
@ -121,6 +121,10 @@ int Downloader::login()
|
||||
{
|
||||
char *pwd;
|
||||
std::string email;
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
std::cout << "Unable to read email and password" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::cout << "Email: ";
|
||||
std::getline(std::cin,email);
|
||||
pwd = getpass("Password: ");
|
||||
|
Loading…
Reference in New Issue
Block a user