feat: exec mode improvements
Use Bollard library to exec in pure Rust. `--use-cli` cli arg, will then only try to exec into containers using Docker. Only try to exec into a container if the state == Running.
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
use crate::app_data::ContainerId;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
use crate::app_data::ContainerId;
|
||||
use bollard::Docker;
|
||||
use tokio::sync::oneshot::Sender;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DockerMessage {
|
||||
Delete(ContainerId),
|
||||
ConfirmDelete(ContainerId),
|
||||
Delete(ContainerId),
|
||||
Exec(Sender<Arc<Docker>>),
|
||||
Pause(ContainerId),
|
||||
Quit,
|
||||
Restart(ContainerId),
|
||||
|
||||
@@ -330,6 +330,7 @@ impl DockerData {
|
||||
|
||||
/// Handle incoming messages, container controls & all container information update
|
||||
/// Spawn Docker commands off into own thread
|
||||
#[allow(clippy::too_many_lines)]
|
||||
async fn message_handler(&mut self) {
|
||||
while let Some(message) = self.receiver.recv().await {
|
||||
let docker = Arc::clone(&self.docker);
|
||||
@@ -338,6 +339,9 @@ impl DockerData {
|
||||
let uuid = Uuid::new_v4();
|
||||
// TODO need to refactor these
|
||||
match message {
|
||||
DockerMessage::Exec(sender) => {
|
||||
sender.send(Arc::clone(&self.docker)).ok();
|
||||
}
|
||||
DockerMessage::Pause(id) => {
|
||||
tokio::spawn(async move {
|
||||
let handle = GuiState::start_loading_animation(&gui_state, uuid);
|
||||
|
||||
Reference in New Issue
Block a user