File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -198,23 +198,21 @@ impl LoginSubcommand {
198
198
. header ( "Content-Type" , "application/json" )
199
199
. body ( Body :: from ( add_req_json) ) ?;
200
200
let response = uds. send_request ( request) . await ?;
201
-
201
+
202
202
if response. status ( ) != StatusCode :: OK {
203
203
let body = response. into_body ( ) ;
204
204
let bytes = body. collect ( ) . await . unwrap_or_default ( ) . to_bytes ( ) ;
205
205
let text: String = String :: from_utf8_lossy ( & bytes) . into ( ) ;
206
-
207
- tracing:: warn!(
208
- "failed to update netrc via determinatenixd, falling back to local-file approach: {}" , & text
209
- ) ;
206
+
207
+ tracing:: warn!( "failed to update netrc via determinate-nixd: {}" , & text) ;
210
208
}
211
209
212
210
token_updated = true ;
213
211
}
214
212
215
213
if !token_updated {
216
214
tracing:: warn!(
217
- "failed to update netrc via determinatenixd , falling back to local-file approach"
215
+ "failed to update netrc via determinate-nixd , falling back to local-file approach"
218
216
) ;
219
217
220
218
// check if user is root or not
@@ -224,7 +222,7 @@ impl LoginSubcommand {
224
222
225
223
update_netrc_file ( & netrc_file_path, & netrc_contents) . await ?;
226
224
227
- // only update user_nix_config if we could not use determinatenixd
225
+ // only update user_nix_config if we could not use determinate-nixd
228
226
upsert_user_nix_config (
229
227
& nix_config_path,
230
228
& netrc_file_string,
Original file line number Diff line number Diff line change 1
1
use std:: path:: Path ;
2
2
3
- use color_eyre:: eyre:: Context as _;
3
+ use color_eyre:: eyre:: { eyre , Context as _} ;
4
4
use serde:: { Deserialize , Serialize } ;
5
5
6
6
#[ derive( Deserialize , Serialize ) ]
@@ -18,6 +18,12 @@ pub async fn update_netrc_file(
18
18
netrc_file_path : & Path ,
19
19
netrc_contents : & str ,
20
20
) -> color_eyre:: Result < ( ) > {
21
+ let parent = netrc_file_path
22
+ . parent ( )
23
+ . ok_or ( eyre ! ( "failed to determinte netrc parent directory" ) ) ?;
24
+
25
+ std:: fs:: create_dir_all ( & parent) . wrap_err ( "failed to ensure directory existed: {}" ) ?;
26
+
21
27
tokio:: fs:: write ( netrc_file_path, & netrc_contents)
22
28
. await
23
29
. wrap_err ( "failed to update netrc file contents" )
You can’t perform that action at this time.
0 commit comments