From 910bf5723ebb7e5b480e30a91dadfba542bfc52a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 7 Aug 2024 11:46:09 +0300 Subject: [PATCH] fix indefinite hang on nh search --- src/search.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/search.rs b/src/search.rs index 43b3a0c..94ff84c 100644 --- a/src/search.rs +++ b/src/search.rs @@ -214,18 +214,13 @@ impl NHRunnable for SearchArgs { } fn my_nix_branch(flake: &FlakeRef) -> Result { - let mut child = std::process::Command::new("nix") + let output = std::process::Command::new("nix") .args(["flake", "metadata", "--json"]) .arg(flake.as_str()) - .stderr(Stdio::inherit()) - .stdout(Stdio::piped()) - .spawn()?; + .output()?; - child.wait()?; - - let stdout = child.stdout.take().wrap_err("Couldn't get stdout")?; - - let mut metadata: FlakeMetadata = serde_json::from_reader(stdout)?; + let stdout = String::from_utf8(output.stdout)?; + let mut metadata: FlakeMetadata = serde_json::from_str(&stdout)?; let branch = metadata .locks