xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/process_wrapper/fake_rustc.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1 //! This binary mocks the output of rustc when run with `--error-format=json` and `--json=artifacts`.
2 
main()3 fn main() {
4     let should_error = std::env::args().any(|arg| arg == "error");
5 
6     eprintln!(r#"{{"rendered": "should be\nin output"}}"#);
7     if should_error {
8         eprintln!("ERROR!\nthis should all\nappear in output.");
9         std::process::exit(1);
10     }
11     eprintln!(r#"{{"emit": "metadata"}}"#);
12     std::thread::sleep(std::time::Duration::from_secs(1));
13     eprintln!(r#"{{"rendered": "should not be in output"}}"#);
14 }
15