diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-06 21:10:35 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-06 21:10:35 +0200 |
commit | 3c22cfcc3c4508641cc6cbc43554f7d6b6a26504 (patch) | |
tree | 038383def0b0c134bc698b81cab9caee406ae8ce | |
parent | pkgs/tskm: Support filtering the show `inputs` in `tskm inputs list` (diff) | |
download | nixos-config-3c22cfcc3c4508641cc6cbc43554f7d6b6a26504.zip |
pkgs/tskm: Fail, when a `task` invocation fails
-rw-r--r-- | pkgs/by-name/ts/tskm/src/task/mod.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkgs/by-name/ts/tskm/src/task/mod.rs b/pkgs/by-name/ts/tskm/src/task/mod.rs index 04efbec5..9c671273 100644 --- a/pkgs/by-name/ts/tskm/src/task/mod.rs +++ b/pkgs/by-name/ts/tskm/src/task/mod.rs @@ -10,14 +10,14 @@ use std::{ fmt::Display, - fs::{self, File, read_to_string}, + fs::{self, read_to_string, File}, path::PathBuf, process::Command, str::FromStr, sync::OnceLock, }; -use anyhow::{Context, Result, bail}; +use anyhow::{bail, Context, Result}; use log::{debug, info, trace}; use taskchampion::Tag; @@ -76,7 +76,6 @@ impl Task { pub fn uuid(&self) -> &taskchampion::Uuid { &self.uuid } - #[must_use] pub fn working_set_id(&self, state: &mut State) -> Result<usize> { Ok(state .replica() @@ -356,5 +355,13 @@ pub(crate) fn run_task(args: &[&str]) -> Result<String> { trace!("Output (stdout): '{}'", stdout.trim()); trace!("Output (stderr): '{}'", stderr.trim()); + if !output.status.success() { + bail!( + "Command `task {}` failed with status: {}", + args.join(" "), + output.status + ); + } + Ok(stdout.trim().to_owned()) } |