Skip to content

Commit b888198

Browse files
committed
chore: Upgrade proc-exit
1 parent 54eaf88 commit b888198

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ derive_more = "0.99.17"
5151
eyre = "0.6"
5252
schemars = { version = "0.8.11", features = ["preserve_order"], optional = true }
5353
clap = { version = "4.0", features = ["derive"], optional = true }
54-
proc-exit = { version = "1.0", optional = true }
54+
proc-exit = { version = "2.0", optional = true }
5555
env_logger = { version = "0.9.1", optional = true }
5656
git2 = { version = "0.15.0", default-features = false, features = ["vendored-libgit2"] }
5757
log = "0.4.17"

src/main.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clap::Parser;
2-
use proc_exit::WithCodeResultExt;
2+
use proc_exit::prelude::*;
33

44
#[derive(Parser)]
55
#[command(about, author, version)]
@@ -32,8 +32,8 @@ fn run() -> proc_exit::ExitResult {
3232
.unwrap_or_else(|| std::env::current_dir().unwrap());
3333

3434
if let Some(input) = args.input.as_deref() {
35-
std::fs::create_dir_all(&output)?;
36-
let mut dag = git_fixture::TodoList::load(input).with_code(proc_exit::Code::CONFIG_ERR)?;
35+
std::fs::create_dir_all(&output).with_code(proc_exit::Code::FAILURE)?;
36+
let mut dag = git_fixture::TodoList::load(input).with_code(proc_exit::bash::USAGE)?;
3737
dag.sleep = dag.sleep.or_else(|| args.sleep.map(|s| s.into()));
3838
dag.run(&output).with_code(proc_exit::Code::FAILURE)?;
3939
} else if let Some(_schema_path) = args.schema.as_deref() {
@@ -44,7 +44,9 @@ fn run() -> proc_exit::ExitResult {
4444
let schema = schemars::schema_for!(git_fixture::TodoList);
4545
let schema = serde_json::to_string_pretty(&schema).unwrap();
4646
if _schema_path == std::path::Path::new("-") {
47-
std::io::stdout().write_all(schema.as_bytes())?;
47+
std::io::stdout()
48+
.write_all(schema.as_bytes())
49+
.with_code(proc_exit::Code::FAILURE)?;
4850
} else {
4951
std::fs::write(&_schema_path, &schema).with_code(proc_exit::Code::FAILURE)?;
5052
}

0 commit comments

Comments
 (0)