From 77b37780e43f955ee9d2e4e5c6f5865972049597 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 11 Dec 2024 11:56:54 +0900 Subject: [PATCH] try --- Cargo.lock | 28 ++++++++++++++++++++++++++++ Cargo.toml | 1 + src/hg_connect_stdio.rs | 11 +++++++++++ 3 files changed, 40 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d5c319a76..3d3201f4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -492,6 +492,7 @@ dependencies = [ "tempfile", "typenum", "url", + "which", "windows-sys 0.52.0", "xz2", "zip", @@ -542,6 +543,15 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "idna" version = "0.5.0" @@ -1069,6 +1079,18 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "which" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b" +dependencies = [ + "either", + "home", + "rustix", + "winsafe", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -1151,6 +1173,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + [[package]] name = "xattr" version = "1.3.1" diff --git a/Cargo.toml b/Cargo.toml index 91b738da7..53b828e4a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,7 @@ tee = "0.1" tempfile = "3" typenum = "1" url = "2" +which = "7" [dependencies.bstr] version = "1" diff --git a/src/hg_connect_stdio.rs b/src/hg_connect_stdio.rs index 1490dac4e..7790b401d 100644 --- a/src/hg_connect_stdio.rs +++ b/src/hg_connect_stdio.rs @@ -231,6 +231,17 @@ pub fn get_stdio_connection(url: &Url, flags: c_int) -> Option> path.as_os_str().as_bytes().to_owned() }; let path = CString::new(path).unwrap(); + warn!(target: "root", "{:?}", which::which("hg")); + if let Ok(hg) = which::which("hg") { + use bstr::ByteSlice; + let output = std::process::Command::new(hg).arg("--version").output().unwrap(); + warn!(target: "root", "{}", output.stdout.as_bstr()); + warn!(target: "root", "{}", output.stderr.as_bstr()); + + let output = std::process::Command::new("/bin/sh").args(["-x", "-c", "hg --version"]).output().unwrap(); + warn!(target: "root", "{}", output.stdout.as_bstr()); + warn!(target: "root", "{}", output.stderr.as_bstr()); + } let proc = unsafe { hg_connect_stdio( userhost.as_ref().map_or(ptr::null(), |s| s.as_ptr()),