(request: &str, stream: &mut S)
| 8 | const DOCKER_SOCKET: &str = "/var/run/docker.sock"; |
| 9 | |
| 10 | fn do_request<S>(request: &str, stream: &mut S) -> Result<Vec<u8>, String> |
| 11 | where |
| 12 | S: Read + Write, |
| 13 | { |
| 14 | debug!("{}\n\n", request); |
| 15 | stream |
| 16 | .write_all(request.as_bytes()) |
| 17 | .map_err(|e| format!("could not write to {}: {}", DOCKER_SOCKET, e))?; |
| 18 | |
| 19 | let mut response = vec![]; |
| 20 | stream |
| 21 | .read_to_end(&mut response) |
| 22 | .map_err(|e| format!("could not read from {}: {}", DOCKER_SOCKET, e))?; |
| 23 | |
| 24 | debug!("{:?}", &response); |
| 25 | |
| 26 | Ok(response) |
| 27 | } |
| 28 | |
| 29 | fn create_exec(container_id: &str, command: &str) -> Result<String, String> { |
| 30 | debug!( |
no outgoing calls
no test coverage detected