diff --git a/CHANGELOG.md b/CHANGELOG.md index 7993bf3..cefe2cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ * Invoke `spamc` using the absolute path `/usr/bin/spamc`. To customise this, set the environment variable `SPAMASSASSIN_MILTER_SPAMC` to the desired path when building the application. -* The minimum supported Rust version is now 1.46.0. +* Update dependencies. ## 0.1.6 (2021-05-17) diff --git a/README.md b/README.md index 576cf78..b060c72 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ recently, `miltertest` had a serious bug that prevents most integration tests in this package from completing; make sure you use an up-to-date version of `miltertest`.) -The minimum supported Rust version is 1.46.0. +The minimum supported Rust version is 1.42.0. [Rust]: https://www.rust-lang.org diff --git a/src/client.rs b/src/client.rs index 4248c48..1fe6797 100644 --- a/src/client.rs +++ b/src/client.rs @@ -26,11 +26,6 @@ pub struct Spamc { } impl Spamc { - const SPAMC_PROGRAM: &'static str = match option_env!("SPAMASSASSIN_MILTER_SPAMC") { - Some(p) => p, - None => "/usr/bin/spamc", - }; - pub fn new(spamc_args: &'static [String]) -> Self { Self { spamc_args, @@ -42,9 +37,11 @@ impl Spamc { impl Process for Spamc { fn connect(&mut self) -> Result<()> { + let spamc_program = option_env!("SPAMASSASSIN_MILTER_SPAMC").unwrap_or("/usr/bin/spamc"); + // `Command::spawn` always succeeds when `spamc` can be invoked, even if // logically the command is invalid, eg if it uses non-existing options. - let mut spamc = Command::new(Spamc::SPAMC_PROGRAM) + let mut spamc = Command::new(spamc_program) .args(self.spamc_args) .stdin(Stdio::piped()) .stdout(Stdio::piped())