Skip to content

Commit

Permalink
Merge pull request #13 from AaronKutch/dev10
Browse files Browse the repository at this point in the history
Version 0.10.0
  • Loading branch information
AaronKutch authored Jan 21, 2024
2 parents c1b1fc4 + e74bb56 commit d73659a
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 5 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "super_orchestrator"
version = "0.9.0"
version = "0.10.0"
edition = "2021"
authors = ["Aaron Kutch <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand All @@ -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" }
Expand All @@ -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"]
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 5 additions & 3 deletions examples/docker_entrypoint_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit d73659a

Please sign in to comment.