From 51a3a35876dd497dea7a763daf22f978662b18ee Mon Sep 17 00:00:00 2001 From: Radu Matei Date: Tue, 26 Sep 2023 21:42:58 +0200 Subject: [PATCH] fix(registry): use rpassword when taking registry password from stdin Signed-off-by: Radu Matei --- src/commands/registry.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/commands/registry.rs b/src/commands/registry.rs index 2bad02761..e307e265c 100644 --- a/src/commands/registry.rs +++ b/src/commands/registry.rs @@ -3,7 +3,7 @@ use anyhow::{Context, Result}; use clap::{Parser, Subcommand}; use indicatif::{ProgressBar, ProgressStyle}; use spin_oci::Client; -use std::{io::Read, path::PathBuf, time::Duration}; +use std::{path::PathBuf, time::Duration}; /// Commands for working with OCI registries to distribute applications. #[derive(Subcommand, Debug)] @@ -149,10 +149,8 @@ impl Login { // Otherwise, if the --password flag was passed with a value, use that value. Finally, if // neither was passed, prompt the user to input the password. let password = if self.password_stdin { - let mut buf = String::new(); let mut stdin = std::io::stdin().lock(); - stdin.read_to_string(&mut buf)?; - buf + rpassword::read_password_from_bufread(&mut stdin)? } else { match self.password { Some(p) => p,