cli: include path to rad binary in rad-debug

This relies on /proc/self/exe being a symlink to the binary, so this
may only work on Linux.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius 2024-03-15 11:56:33 +02:00 committed by Alexis Sellier
parent 5ae617abf0
commit 5fce714ba5
No known key found for this signature in database
1 changed files with 6 additions and 0 deletions

View File

@ -68,6 +68,11 @@ fn debug(profile: &Profile) -> anyhow::Result<()> {
}));
let debug = DebugInfo {
rad_exe: if let Ok(filename) = std::fs::read_link("/proc/self/exe") {
Some(filename)
} else {
None
},
rad_version: VERSION,
radicle_node_version: stdout_of("radicle-node", &["--version"])
.unwrap_or("<unknown>".into()),
@ -92,6 +97,7 @@ fn debug(profile: &Profile) -> anyhow::Result<()> {
#[allow(dead_code)]
#[serde(rename_all = "camelCase")]
struct DebugInfo {
rad_exe: Option<PathBuf>,
rad_version: &'static str,
radicle_node_version: String,
git_remote_rad_version: String,