Skip to content

Commit 0f3b391

Browse files
committed
fix(token-from-stdout): Treat process spawn errors as unsupported
Like with `libsecret` not being present, process spawn errors can be treated as an indication that that config entry isn't relevant for the current machine and we should try other entries. If there is nothing else to fallback to, we'll still report this error.
1 parent cea204f commit 0f3b391

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cargo/util/credential/adaptor.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77

88
use anyhow::Context;
99
use cargo_credential::{
10-
Action, CacheControl, Credential, CredentialResponse, RegistryInfo, Secret,
10+
Action, CacheControl, Credential, CredentialResponse, Error, ErrorKind, RegistryInfo, Secret,
1111
};
1212

1313
pub struct BasicProcessCredential {}
@@ -33,7 +33,10 @@ impl Credential for BasicProcessCredential {
3333
cmd.env("CARGO_REGISTRY_NAME_OPT", name);
3434
}
3535
cmd.stdout(Stdio::piped());
36-
let mut child = cmd.spawn().context("failed to spawn credential process")?;
36+
let mut child = cmd
37+
.spawn()
38+
.context("failed to spawn credential process")
39+
.map_err(|err| Error::from(err).with_kind(ErrorKind::UrlNotSupported))?;
3740
let mut buffer = String::new();
3841
child
3942
.stdout

0 commit comments

Comments
 (0)