File tree 2 files changed +16
-6
lines changed 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -764,14 +764,14 @@ pub fn registry_login(
764
764
. with_context ( || "failed to read stdin" ) ?;
765
765
// Automatically remove `cargo login` from an inputted token to
766
766
// allow direct pastes from `registry.host()`/me.
767
- line = line. replace ( "cargo login" , "" ) . trim ( ) . to_string ( ) ;
768
- if line. is_empty ( ) {
769
- bail ! ( "please provide a non-empty token" ) ;
770
- }
771
- line
767
+ line. replace ( "cargo login" , "" ) . trim ( ) . to_string ( )
772
768
}
773
769
} ;
774
770
771
+ if token. is_empty ( ) {
772
+ bail ! ( "please provide a non-empty token" ) ;
773
+ }
774
+
775
775
if let RegistryConfig :: Token ( old_token) = & reg_cfg {
776
776
if old_token == & token {
777
777
config. shell ( ) . status ( "Login" , "already logged in" ) ?;
Original file line number Diff line number Diff line change @@ -106,5 +106,15 @@ fn empty_login_token() {
106
106
" ,
107
107
)
108
108
. with_status ( 101 )
109
- . run ( )
109
+ . run ( ) ;
110
+
111
+ cargo_process ( "login" )
112
+ . arg ( "" )
113
+ . with_stderr (
114
+ "\
115
+ [ERROR] please provide a non-empty token
116
+ " ,
117
+ )
118
+ . with_status ( 101 )
119
+ . run ( ) ;
110
120
}
You can’t perform that action at this time.
0 commit comments