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

fix(registry): use rpassword when taking registry password from stdin #1811

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/commands/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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,
Expand Down
Loading