File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,15 @@ impl Credentials {
7070 _ => return Err ( "SSH key not available" . into ( ) ) ,
7171 } ;
7272
73- // When running on production, ensure the file is created in tmpfs and not persisted to disk
74- # [ cfg ( target_os = "linux" ) ]
75- let mut temp_key_file = tempfile :: Builder :: new ( ) . tempfile_in ( "/dev/shm" ) ? ;
76-
77- // For other platforms, default to std::env::tempdir()
78- # [ cfg ( not ( target_os = "linux" ) ) ]
79- let mut temp_key_file = tempfile :: Builder :: new ( ) . tempfile ( ) ? ;
73+ let dir = if cfg ! ( target_os = "linux" ) {
74+ // When running on production, ensure the file is created in tmpfs and not persisted to disk
75+ "/dev/shm" . into ( )
76+ } else {
77+ // For other platforms, default to std::env::tempdir()
78+ std :: env :: temp_dir ( )
79+ } ;
8080
81+ let mut temp_key_file = tempfile:: Builder :: new ( ) . tempfile_in ( dir) ?;
8182 temp_key_file. write_all ( key. as_bytes ( ) ) ?;
8283
8384 Ok ( temp_key_file. into_temp_path ( ) )
You can’t perform that action at this time.
0 commit comments