aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/bin/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rust-analyzer/src/bin/main.rs')
-rw-r--r--crates/rust-analyzer/src/bin/main.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 9a54193f6..0cddfecb5 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -21,6 +21,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
21 21
22fn main() { 22fn main() {
23 if let Err(err) = try_main() { 23 if let Err(err) = try_main() {
24 log::error!("Unexpected error: {}", err);
24 eprintln!("{}", err); 25 eprintln!("{}", err);
25 process::exit(101); 26 process::exit(101);
26 } 27 }
@@ -28,6 +29,14 @@ fn main() {
28 29
29fn try_main() -> Result<()> { 30fn try_main() -> Result<()> {
30 let args = args::Args::parse()?; 31 let args = args::Args::parse()?;
32 if args.wait_dbg {
33 #[allow(unused_mut)]
34 let mut d = 4;
35 while d == 4 {
36 d = 4;
37 }
38 }
39
31 setup_logging(args.log_file, args.no_buffering)?; 40 setup_logging(args.log_file, args.no_buffering)?;
32 match args.command { 41 match args.command {
33 args::Command::RunServer => run_server()?, 42 args::Command::RunServer => run_server()?,
@@ -56,7 +65,7 @@ fn try_main() -> Result<()> {
56 Ok(()) 65 Ok(())
57} 66}
58 67
59fn setup_logging(log_file: Option<PathBuf>, flush_file: bool) -> Result<()> { 68fn setup_logging(log_file: Option<PathBuf>, no_buffering: bool) -> Result<()> {
60 env::set_var("RUST_BACKTRACE", "short"); 69 env::set_var("RUST_BACKTRACE", "short");
61 70
62 let log_file = match log_file { 71 let log_file = match log_file {
@@ -69,7 +78,7 @@ fn setup_logging(log_file: Option<PathBuf>, flush_file: bool) -> Result<()> {
69 None => None, 78 None => None,
70 }; 79 };
71 let filter = env::var("RA_LOG").ok(); 80 let filter = env::var("RA_LOG").ok();
72 logger::Logger::new(log_file, flush_file, filter.as_deref()).install(); 81 logger::Logger::new(log_file, no_buffering, filter.as_deref()).install();
73 82
74 tracing_setup::setup_tracing()?; 83 tracing_setup::setup_tracing()?;
75 84