MCPcopy Create free account
hub / github.com/Metaswitch/floki / run

Method run

src/command.rs:43–78  ·  view source on GitHub ↗
(&self, command: I)

Source from the content-addressed store, hash-verified

41
42impl DockerCommandBuilder {
43 pub fn run<I, S>(&self, command: I) -> Result<(), Error>
44 where
45 I: IntoIterator<Item = S> + std::fmt::Debug,
46 S: AsRef<OsStr>,
47 {
48 debug!("Spawning docker command with configuration: {self:?}");
49 debug!("- and args: {command:?}");
50
51 let mut command = Command::new("docker")
52 .args(self.base_args())
53 .args(self.build_volume_switches())
54 .args(self.build_environment_switches())
55 .args(self.build_docker_switches())
56 .arg(&self.image)
57 .args(command)
58 .stdout(Stdio::inherit())
59 .stderr(Stdio::inherit())
60 .stdin(Stdio::inherit())
61 .spawn()
62 .map_err(|e| FlokiError::FailedToLaunchDocker { error: e })?;
63
64 let exit_status = command
65 .wait()
66 .map_err(|e| FlokiError::FailedToCompleteDockerCommand { error: e })?;
67 if exit_status.success() {
68 Ok(())
69 } else {
70 Err(FlokiError::RunContainerFailed {
71 exit_status: FlokiSubprocessExitStatus {
72 process_description: "docker run".into(),
73 exit_status,
74 },
75 }
76 .into())
77 }
78 }
79
80 pub fn start_as_daemon(self, command: &[&str]) -> Result<DaemonHandle, Error> {
81 debug!("Starting daemon container '{}'", self.name);

Callers 5

run_floki_containerFunction · 0.80
uFunction · 0.80
OFunction · 0.80
iFunction · 0.80
XbFunction · 0.80

Calls 4

base_argsMethod · 0.80
build_volume_switchesMethod · 0.80
build_docker_switchesMethod · 0.80

Tested by

no test coverage detected