1234use std::{5 collections::HashMap,6 ffi::{OsStr, OsString},7 fmt::{self, Display},8 path::PathBuf,9 process::Stdio,10 sync::{Arc, OnceLock},11};1213use anyhow::{anyhow, bail, ensure, Context, Result};14use better_command::{ClonableHandler, Handler, NixHandler, NoopHandler};15use futures::StreamExt;16use itertools::Itertools;17use serde::{de::DeserializeOwned, Deserialize, Serialize};18use tokio::{19 io::AsyncWriteExt,20 process::{ChildStderr, ChildStdin, ChildStdout, Command},21 select,22 sync::{mpsc, oneshot, Mutex},23};24use tracing::{debug, error, warn, Level};