@@ -310,7 +310,7 @@ path = "lib.rs"
310
310
File :: create ( dir. join ( "lib.rs" ) ) . unwrap ( ) ;
311
311
// Prepare xargo invocation.
312
312
let target = get_arg_flag_value ( "--target" ) ;
313
- let print_env = !ask_user && has_arg_flag ( "--env " ) ; // whether we just print the necessary environment variable
313
+ let print_sysroot = !ask_user && has_arg_flag ( "--print-sysroot " ) ; // whether we just print the sysroot path
314
314
let mut command = xargo ( ) ;
315
315
command. arg ( "build" ) . arg ( "-q" ) ;
316
316
command. current_dir ( & dir) ;
@@ -339,13 +339,9 @@ path = "lib.rs"
339
339
} ;
340
340
let sysroot = if is_host { dir. join ( "HOST" ) } else { PathBuf :: from ( dir) } ;
341
341
std:: env:: set_var ( "MIRI_SYSROOT" , & sysroot) ; // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
342
- if print_env {
343
- // Escape an arbitrary string for the shell: by wrapping it in `'`, the only special
344
- // character we have to worry about is `'` itself. Everything else is taken literally
345
- // in these strings. `'` is encoded as `'"'"'`: the outer `'` end and being a
346
- // `'`-quoted string, respectively; the `"'"` in the middle represents a single `'`.
347
- // (We could use `'\''` instead of `'"'"'` if we wanted but let's avoid backslashes.)
348
- println ! ( "MIRI_SYSROOT='{}'" , sysroot. display( ) . to_string( ) . replace( '\'' , r#"'"'"'"# ) ) ;
342
+ if print_sysroot {
343
+ // Print just the sysroot and nothing else; this way we do not need any escaping.
344
+ println ! ( "{}" , sysroot. display( ) ) ;
349
345
} else if !ask_user {
350
346
println ! ( "A libstd for Miri is now available in `{}`." , sysroot. display( ) ) ;
351
347
}
0 commit comments