From b6c3ce21cae55477012cab0f5f69801fd3d028c3 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 27 Feb 2023 02:56:38 +0000 Subject: [PATCH] fix: move final stout flush to main.rs --- src/main.rs | 10 ++++++---- src/ui/mod.rs | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 56b198f..660ae64 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,13 @@ #![forbid(unsafe_code)] #![warn( + clippy::nursery, + clippy::pedantic, clippy::expect_used, clippy::todo, clippy::unused_async, clippy::unwrap_used )] // Warning - These are indeed pedantic -#![warn(clippy::pedantic)] -#![warn(clippy::nursery)] #![allow( clippy::module_name_repetitions, clippy::doc_markdown, @@ -23,7 +23,7 @@ use docker_data::DockerData; use input_handler::InputMessages; use parking_lot::Mutex; use parse_args::CliArgs; -use std::sync::{atomic::AtomicBool, Arc}; +use std::{sync::{atomic::AtomicBool, Arc}, io::Write}; use tokio::sync::mpsc::{Receiver, Sender}; use tracing::{info, Level}; @@ -39,7 +39,7 @@ use ui::{create_ui, GuiState, Status}; use crate::docker_data::DockerMessage; // this is the entry point when running as a Docker Container, and is used, in conjunction with the `CONTAINER_ENV` ENV, to check if we are running as a Docker Container -const ENTRY_POINT: &str = "./app/oxker"; +const ENTRY_POINT: &str = "/app/oxker"; const ENV_KEY: &str = "OXKER_RUNTIME"; const ENV_VALUE: &str = "container"; @@ -146,4 +146,6 @@ async fn main() { .await; } } + // Clear screen + std::io::stdout().flush().unwrap_or(()); } diff --git a/src/ui/mod.rs b/src/ui/mod.rs index a7006a1..d4720ed 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -6,7 +6,7 @@ use crossterm::{ }; use parking_lot::Mutex; use std::{ - io::{self, Write}, + io, sync::{atomic::Ordering, Arc}, }; use std::{sync::atomic::AtomicBool, time::Instant}; @@ -62,7 +62,6 @@ pub async fn create_ui( if let Err(err) = res { println!("error: {err}"); } - std::io::stdout().flush().unwrap_or(()); Ok(()) }