Skip to content

Commit

Permalink
Auto merge of #998 - RalfJung:comment, r=RalfJung
Browse files Browse the repository at this point in the history
explain our shell encoding

Follow-up to #980
  • Loading branch information
bors committed Oct 15, 2019
2 parents 42c1e77 + 4ba63fb commit 0d01c30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/bin/cargo-miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ path = "lib.rs"
let sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) };
std::env::set_var("MIRI_SYSROOT", &sysroot); // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
if print_env {
// Escape an arbitrary string for the shell: by wrapping it in `'`, the only special
// character we have to worry about is `'` itself. Everything else is taken literally
// in these strings. `'` is encoded as `'"'"'`: the outer `'` end and being a
// `'`-quoted string, respectively; the `"'"` in the middle represents a single `'`.
// (We could use `'\''` instead of `'"'"'` if we wanted but let's avoid backslashes.)
println!("MIRI_SYSROOT='{}'", sysroot.display().to_string().replace('\'', r#"'"'"'"#));
} else if !ask_user {
println!("A libstd for Miri is now available in `{}`.", sysroot.display());
Expand Down

0 comments on commit 0d01c30

Please sign in to comment.