handle ^D and ^C while password prompting

This commit is contained in:
Jethro Grassie
2018-02-01 15:32:30 -05:00
parent ed67e5c001
commit a4b50a6f51
4 changed files with 24 additions and 6 deletions
+2
View File
@@ -31,6 +31,7 @@
#pragma once
#include <string>
#include <atomic>
#include <boost/optional/optional.hpp>
#include "wipeable_string.h"
@@ -49,6 +50,7 @@ namespace tools
//! \return A password from stdin TTY prompt or `std::cin` pipe.
static boost::optional<password_container> prompt(bool verify, const char *mesage = "Password");
static std::atomic<bool> is_prompting;
password_container(const password_container&) = delete;
password_container(password_container&& rhs) = default;