55#![ allow( warnings) ]
66
77use std:: collections:: HashMap ;
8- use std:: ffi:: OsStr ;
8+ use std:: ffi:: { OsStr , OsString } ;
99use std:: fmt:: { Debug , Formatter } ;
1010use std:: hash:: { DefaultHasher , Hash , Hasher } ;
1111use std:: path:: Path ;
@@ -69,9 +69,9 @@ impl OutputMode {
6969/// [allow_failure]: BootstrapCommand::allow_failure
7070/// [delay_failure]: BootstrapCommand::delay_failure
7171pub struct BootstrapCommand {
72- program : String ,
73- args : Vec < String > ,
74- envs : Vec < ( String , String ) > ,
72+ program : OsString ,
73+ args : Vec < OsString > ,
74+ envs : Vec < ( OsString , OsString ) > ,
7575 cwd : Option < PathBuf > ,
7676
7777 command : Command ,
@@ -90,8 +90,7 @@ impl<'a> BootstrapCommand {
9090 }
9191
9292 pub fn arg < S : AsRef < OsStr > > ( & mut self , arg : S ) -> & mut Self {
93- let arg_str = arg. as_ref ( ) . to_string_lossy ( ) . into_owned ( ) ;
94- self . args . push ( arg_str. clone ( ) ) ;
93+ self . args . push ( arg. as_ref ( ) . to_os_string ( ) ) ;
9594 self . command . arg ( arg. as_ref ( ) ) ;
9695 self
9796 }
@@ -112,9 +111,7 @@ impl<'a> BootstrapCommand {
112111 K : AsRef < OsStr > ,
113112 V : AsRef < OsStr > ,
114113 {
115- let key_str = key. as_ref ( ) . to_string_lossy ( ) . into_owned ( ) ;
116- let val_str = val. as_ref ( ) . to_string_lossy ( ) . into_owned ( ) ;
117- self . envs . push ( ( key_str. clone ( ) , val_str. clone ( ) ) ) ;
114+ self . envs . push ( ( key. as_ref ( ) . to_os_string ( ) , val. as_ref ( ) . to_os_string ( ) ) ) ;
118115 self . command . env ( key, val) ;
119116 self
120117 }
@@ -249,7 +246,7 @@ impl From<Command> for BootstrapCommand {
249246 let program = command. get_program ( ) . to_owned ( ) ;
250247
251248 Self {
252- program : program. clone ( ) . into_string ( ) . unwrap ( ) ,
249+ program : program. clone ( ) ,
253250 args : Vec :: new ( ) ,
254251 envs : Vec :: new ( ) ,
255252 cwd : None ,
0 commit comments