Implement most of process completion matching

(except ExitSignal)
This commit is contained in:
Félix Saparelli 2021-12-21 17:56:14 +13:00
parent e7de00edfe
commit e4d669e230
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
2 changed files with 10 additions and 5 deletions

View File

@ -13,7 +13,7 @@ use tracing::{debug, trace, trace_span, warn};
use unicase::UniCase;
use crate::error::RuntimeError;
use crate::event::{Event, FileType, Tag};
use crate::event::{Event, FileType, ProcessEnd, Tag};
use crate::filter::tagged::error::TaggedFiltererError;
use crate::filter::Filterer;
use crate::ignore_files::IgnoreFile;
@ -368,9 +368,15 @@ impl TaggedFilterer {
|| filter.matches(format!("SIG{}", text))?
|| filter.matches(int.to_string())?)
}
(Tag::ProcessCompletion(_oes), Matcher::ProcessCompletion) => {
todo!("tagged filterer: completion matcher") // TODO
}
(Tag::ProcessCompletion(ope), Matcher::ProcessCompletion) => match ope {
None => filter.matches("_"),
Some(ProcessEnd::Success) => filter.matches("success"),
Some(ProcessEnd::ExitError(int)) => filter.matches(format!("error({})", int)),
Some(ProcessEnd::ExitSignal(sig)) => todo!("process completion: signal"),
Some(ProcessEnd::ExitStop(int)) => filter.matches(format!("stop({})", int)),
Some(ProcessEnd::Exception(int)) => filter.matches(format!("exception({})", int)),
Some(ProcessEnd::Continued) => filter.matches("continued"),
},
(_, _) => {
trace!("no match for tag, skipping");
return Ok(None);

View File

@ -293,7 +293,6 @@ async fn complete_any() {
filterer.complete_does_pass(Some(ProcessEnd::Success));
filterer.complete_does_pass(Some(ProcessEnd::ExitError(NonZeroI64::new(1).unwrap())));
filterer.complete_does_pass(None);
filterer.pid_doesnt_pass(0);
}
#[tokio::test]