Skip to content

Providing a token to cargo login via command line causes a hang on CI #12438

Closed
@DrChat

Description

@DrChat

Problem

Specifying the logon token via the command-line will cause a hang if stdin is not attached to a terminal (such as when running in automation).

Steps

cargo login --registry xxxxxxxx "Bearer XXXXXXXXXXXXXXXXXXXXXXXXX"

Possible Solution(s)

Workaround:

"Bearer XXXXXXXXXXXXXXXXXXXXXXXXX" | cargo login --registry xxxxxxxx

Notes

Likely introduced by #12334:

if !std::io::stdin().is_terminal() {
let token = std::io::read_to_string(std::io::stdin()).unwrap_or_default();
if !token.is_empty() {
token_from_stdin = Some(token);
}
}
let token = token_from_cmdline.or_else(|| token_from_stdin.as_deref().map(Secret::from));

Version

cargo 1.73.0-nightly (c91a693e7 2023-07-31)
release: 1.73.0-nightly
commit-hash: c91a693e7977e33a1064b63a5daf5fb689f01651
commit-date: 2023-07-31
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Ubuntu 20.04 (focal) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-loginP-highPriority: HighS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewregression-from-stable-to-nightlyRegression in nightly that previously worked in stable.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions