From 3732fd5747efc15fbb15d8e1787ff4cb6bc7c9e8 Mon Sep 17 00:00:00 2001 From: Nathan Fiedler Date: Wed, 23 Mar 2016 18:00:52 -0700 Subject: [PATCH] Report missing MagickWand-config in build.rs Since build.rs requires MagickWand-config, make an effort to determine if the executable is available or not, and panic with a clear course of action. Otherwise the error is rather cryptic. Fixes #3 cargo test passes --- build.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.rs b/build.rs index c0b9be6..416601f 100644 --- a/build.rs +++ b/build.rs @@ -49,6 +49,10 @@ fn main() { .current_dir("rust-bindgen") .status().unwrap(); } + // Ensure MagickWand-config is in the PATH and report clearly if not. + if !Command::new("which").arg("MagickWand-config").status().unwrap().success() { + panic!("MagickWand-config not in the PATH, please install ImageMagick"); + } // Create the header file that rust-bindgen needs as input. let mut gen_h = match File::create("gen.h") { Err(why) => panic!("could not create gen.h file: {}", Error::description(&why)),