Implemented custom command builder with nicer api suited for my needs. Also returned error if there are no containers in `scripts::postgres::get_containers`.
16 lines
358 B
Rust
16 lines
358 B
Rust
use anyhow::Result;
|
|
|
|
use crate::command_builder::CommandBuilder;
|
|
|
|
pub fn stop_all() -> Result<()> {
|
|
let running_containers = CommandBuilder::docker().args("ps -q").exec_get_stdout()?;
|
|
|
|
if running_containers.is_empty() {
|
|
return Ok(());
|
|
}
|
|
|
|
CommandBuilder::docker()
|
|
.args(&format!("stop {running_containers}"))
|
|
.exec()
|
|
}
|