diff --git a/rustainers/src/cmd/mod.rs b/rustainers/src/cmd/mod.rs index ce57026..615c80d 100644 --- a/rustainers/src/cmd/mod.rs +++ b/rustainers/src/cmd/mod.rs @@ -14,7 +14,7 @@ pub use self::error::*; #[derive(Debug, Clone)] pub(crate) struct Cmd<'a> { - command: &'a str, + pub(crate) command: &'a str, args: Vec, dir: Option<&'a Path>, env: IndexMap, diff --git a/rustainers/src/runner/inner.rs b/rustainers/src/runner/inner.rs index 3b1b1bb..d440b73 100644 --- a/rustainers/src/runner/inner.rs +++ b/rustainers/src/runner/inner.rs @@ -228,7 +228,12 @@ pub(crate) trait InnerRunner: Display + Debug + Send + Sync { #[tracing::instrument(level = "debug", skip(self), fields(runner = %self))] async fn list_custom_networks(&self) -> Result, ContainerError> { let mut cmd = self.command(); - cmd.push_args(["network", "ls", "--no-trunc", "--format={{json .}}"]); + cmd.push_args(["network", "ls", "--format={{json .}}"]); + + if cmd.command != "nerctl" { + cmd.push_arg("--no-trunc"); + } + let mut result = cmd.json_stream::().await?; result.retain(|x| ["bridge", "host", "none"].contains(&x.name.as_str())); Ok(result)