mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Add panic subcommand to check backtraces
This commit is contained in:
+4
-1
@@ -40,7 +40,7 @@ use tracing_subscriber::EnvFilter;
|
|||||||
use utils::spawn;
|
use utils::spawn;
|
||||||
use watcher::Watcher;
|
use watcher::Watcher;
|
||||||
|
|
||||||
use crate::utils::{REMOVE_ENV_RUST_BACKTRACE, REMOVE_ENV_RUST_LIB_BACKTRACE};
|
use crate::utils::{cause_panic, REMOVE_ENV_RUST_BACKTRACE, REMOVE_ENV_RUST_LIB_BACKTRACE};
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(author, version, about, long_about = None)]
|
#[command(author, version, about, long_about = None)]
|
||||||
@@ -67,6 +67,8 @@ enum Sub {
|
|||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
config: Option<PathBuf>,
|
config: Option<PathBuf>,
|
||||||
},
|
},
|
||||||
|
/// Cause a panic to check if the backtraces are good.
|
||||||
|
Panic,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
@@ -118,6 +120,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
info!("config is valid");
|
info!("config is valid");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
Sub::Panic => cause_panic(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,3 +190,9 @@ pub fn show_screenshot_notification(image_path: Option<PathBuf>) {
|
|||||||
warn!("error showing screenshot notification: {err:?}");
|
warn!("error showing screenshot notification: {err:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cause_panic() {
|
||||||
|
let a = Duration::from_secs(1);
|
||||||
|
let b = Duration::from_secs(2);
|
||||||
|
let _ = a - b;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user