mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-05 10:26:36 +00:00
Rm unnecessary warning msg "Failed to read git credential file" (#1479)
* Rm unnecessary warning msg "Failed to read git credential file" Fixed #1476 If `gh auth token` executed successfully and binstall obtained a gh token from it, then there's no reason to issue any warning msg. Only when binstall cannot read from `.git-credential` and `gh auth token` failed does binstall need to issue warning. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix clippy warning Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
3414c4ee83
commit
d76a40bf7d
3 changed files with 11 additions and 29 deletions
crates/bin/src
|
@ -1,9 +1,8 @@
|
|||
use std::{io, process};
|
||||
|
||||
use compact_str::CompactString;
|
||||
use tracing::warn;
|
||||
|
||||
fn get_inner() -> io::Result<CompactString> {
|
||||
pub(super) fn get() -> io::Result<CompactString> {
|
||||
let process::Output { status, stdout, .. } = process::Command::new("gh")
|
||||
.args(["auth", "token"])
|
||||
.stdin(process::Stdio::null())
|
||||
|
@ -26,13 +25,3 @@ fn get_inner() -> io::Result<CompactString> {
|
|||
|
||||
Ok(s.trim().into())
|
||||
}
|
||||
|
||||
pub(super) fn get() -> Option<CompactString> {
|
||||
match get_inner() {
|
||||
Ok(token) => Some(token),
|
||||
Err(err) => {
|
||||
warn!(?err, "Failed to retrieve token from `gh auth token`");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue