From e74bb56be8b37f95f91d9d5842a7dc9698e5e686 Mon Sep 17 00:00:00 2001 From: Aaron Kutch Date: Sat, 20 Jan 2024 23:20:47 -0600 Subject: [PATCH] Version 0.10.0 --- CHANGELOG.md | 11 +++++++++++ Cargo.toml | 12 +++++------- README.md | 8 +++++++- examples/docker_entrypoint_pattern.rs | 8 +++++--- src/command.rs | 2 ++ src/lib.rs | 3 +-- src/misc.rs | 4 +--- 7 files changed, 32 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 511be15..0e7a0f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.10.0] - 2024-1-20 +### Fixes +- Fixed compilation on Windows +- Fixed an issue with an example + +### Changes +- Updated `env_logger` to 0.11 +- Removed the "ctrlc_support" and "env_logger_support" features, their functionality is always + enabled now +- Made "nix_support" not default, which improves usage on non-Unix targets + ## [0.9.0] - 2023-11-11 ### Fixes - Fixed that `Command`s and all downstream constructs would add an extra newline byte at the end of diff --git a/Cargo.toml b/Cargo.toml index 3452b23..03cff0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "super_orchestrator" -version = "0.9.0" +version = "0.10.0" edition = "2021" authors = ["Aaron Kutch "] license = "MIT OR Apache-2.0" @@ -12,11 +12,11 @@ description = "programmable container orchestration tools" [dependencies] clap = "4" -ctrlc = { version = "3", optional = true, default-features = false } -env_logger = { version = "0.10", optional = true, default-features = false } +ctrlc = { version = "3", default-features = false } +env_logger = { version = "0.11", default-features = false } log = "0.4" nix = { version = "0.27", optional = true, default-features = false, features = ["signal"] } -owo-colors = { version = "3.5", default-features = false } +owo-colors = { version = "4.0", default-features = false } postcard = { version = "1", features = ["use-std"] } serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" } @@ -31,8 +31,6 @@ uuid = { version = "1", features = ["v4"] } clap = { version = "4", features = ["derive", "env"] } [features] -default = ["ctrlc_support", "env_logger_support", "nix_support"] -ctrlc_support = ["ctrlc"] -env_logger_support = ["env_logger"] +default = [] # needed for Unix signals on `Command`s nix_support = ["nix"] diff --git a/README.md b/README.md index 5ff7265..9ecbbe6 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,10 @@ convenient tools for file management, command running, and Docker container mana First, see the documentation of `stacked_errors` (https://docs.rs/stacked_errors/latest/stacked_errors/) to understand the error strategy. Then, look over the documentation. Finally, check the examples in order of: paths, basic_commands, -basic_containers, commands, dockerfile_entrypoint_pattern, postgres, and clean +basic_containers, commands, dockerfile_entrypoint_pattern, postgres, and clean. + +Note that Windows has several intrinsic issues such as cross compilation being a pain (the +dockerfile entrypoint pattern will not work without a lot of setup). Any of the examples with +UNIX specific commands will of course not work. + +The "nix_support" feature enables some functions to be able to send UNIX signals to commands. diff --git a/examples/docker_entrypoint_pattern.rs b/examples/docker_entrypoint_pattern.rs index 78763f0..ca104be 100644 --- a/examples/docker_entrypoint_pattern.rs +++ b/examples/docker_entrypoint_pattern.rs @@ -80,16 +80,18 @@ async fn container_runner(args: &Args) -> Result<()> { let container_target = "x86_64-unknown-linux-gnu"; // build internal runner with `--release` - //sh("cargo build --release --bin", &[ + //sh([ + // "cargo build --release --bin", // bin_entrypoint, // "--target", // container_target, //]) - //.await.stack()?; + //.await + //.stack()?; //let entrypoint = // &format!("./target/{container_target}/release/{bin_entrypoint}"); - // for this example we need this command + // because this is an example we need a slightly different path sh([ "cargo build --release --example", bin_entrypoint, diff --git a/src/command.rs b/src/command.rs index 2def6cd..c2b872f 100644 --- a/src/command.rs +++ b/src/command.rs @@ -712,6 +712,8 @@ impl Command { } } +/// Note: there are `send_unix_signal` and `send_unix_sigterm` function that can +/// be enabled by the "nix_support" feature impl CommandRunner { /// Attempts to force the command to exit, but does not wait for the request /// to take effect. This does not set `self.result`. diff --git a/src/lib.rs b/src/lib.rs index 0118c0c..e20cbfe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,8 +5,7 @@ mod parsing; mod paths; pub use command::*; pub mod docker; -/// Miscellanious docker helpers enabled by "ctrlc_support" -#[cfg(feature = "ctrlc_support")] +/// Miscellanious docker helpers pub mod docker_helpers; /// Communication with `NetMessenger` pub mod net_message; diff --git a/src/misc.rs b/src/misc.rs index d9edd99..523d2ee 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -19,11 +19,10 @@ use tokio::{ use crate::{acquire_dir_path, Command}; -/// use the "ctrlc_support" feature to see functions that use this +/// Used by [crate::ctrlc_init] and [crate::ctrlc_issued_reset] pub static CTRLC_ISSUED: AtomicBool = AtomicBool::new(false); /// Sets up the ctrl-c handler -#[cfg(feature = "ctrlc_support")] pub fn ctrlc_init() -> Result<()> { ctrlc::set_handler(move || { CTRLC_ISSUED.store(true, Ordering::SeqCst); @@ -33,7 +32,6 @@ pub fn ctrlc_init() -> Result<()> { } /// Sets up `env_logger` with `LevelFilter::Info` -#[cfg(feature = "env_logger_support")] pub fn std_init() -> Result<()> { env_logger::Builder::new() .filter_level(log::LevelFilter::Info)