|
@@ -13,19 +13,19 @@
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
-Result<SecretString, OSError> get_password(const StringView& prompt)
|
|
|
+ErrorOr<SecretString> get_password(StringView prompt)
|
|
|
{
|
|
|
if (write(STDOUT_FILENO, prompt.characters_without_null_termination(), prompt.length()) < 0)
|
|
|
- return OSError(errno);
|
|
|
+ return Error::from_errno(errno);
|
|
|
|
|
|
termios original {};
|
|
|
if (tcgetattr(STDIN_FILENO, &original) < 0)
|
|
|
- return OSError(errno);
|
|
|
+ return Error::from_errno(errno);
|
|
|
|
|
|
termios no_echo = original;
|
|
|
no_echo.c_lflag &= ~ECHO;
|
|
|
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &no_echo) < 0)
|
|
|
- return OSError(errno);
|
|
|
+ return Error::from_errno(errno);
|
|
|
|
|
|
char* password = nullptr;
|
|
|
size_t n = 0;
|
|
@@ -37,7 +37,7 @@ Result<SecretString, OSError> get_password(const StringView& prompt)
|
|
|
putchar('\n');
|
|
|
|
|
|
if (line_length < 0)
|
|
|
- return OSError(saved_errno);
|
|
|
+ return Error::from_errno(saved_errno);
|
|
|
|
|
|
VERIFY(line_length != 0);
|
|
|
|