Skip to content

Commit

Permalink
Enable profiling env var
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Jun 14, 2024
1 parent 2080a43 commit 0a92416
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/paralegal-flow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,18 @@ impl rustc_plugin::RustcPlugin for DfppPlugin {

let opts = Box::leak(Box::new(plugin_args));

const RERUN_VAR: &str = "RERUN_WITH_DEBUGGER";
if let Ok(debugger) = std::env::var(RERUN_VAR) {
println!("Restarting with debugger '{debugger}'");
let mut dsplit = debugger.split(' ');
let mut cmd = std::process::Command::new(dsplit.next().unwrap());
cmd.args(dsplit)
.args(std::env::args())
.env_remove(RERUN_VAR);
println!("{cmd:?}");
std::process::exit(cmd.status().unwrap().code().unwrap_or(0));
}

compiler_args.extend([
"--cfg".into(),
"paralegal".into(),
Expand Down

0 comments on commit 0a92416

Please sign in to comment.