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 {
70
70
_ => return Err ( "SSH key not available" . into ( ) ) ,
71
71
} ;
72
72
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
+ } ;
80
80
81
+ let mut temp_key_file = tempfile:: Builder :: new ( ) . tempfile_in ( dir) ?;
81
82
temp_key_file. write_all ( key. as_bytes ( ) ) ?;
82
83
83
84
Ok ( temp_key_file. into_temp_path ( ) )
You can’t perform that action at this time.
0 commit comments