Skip to content

Commit 22a66be

Browse files
authored
Merge pull request #2284 from kornelski/cargo-warnings
Ensure beginning and end of the error output is readable
2 parents a94ccf2 + eeb920f commit 22a66be

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

openssl-sys/build/find_normal.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,21 @@ fn find_openssl_dir(target: &str) -> OsString {
102102
return OsString::from("/usr/local");
103103
}
104104

105+
let msg_header =
106+
"Could not find directory of OpenSSL installation, and this `-sys` crate cannot
107+
proceed without this knowledge. If OpenSSL is installed and this crate had
108+
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
109+
compilation process.";
110+
111+
println!(
112+
"cargo:warning={} See stderr section below for further information.",
113+
msg_header.replace('\n', " ")
114+
);
115+
105116
let mut msg = format!(
106117
"
107118
108-
Could not find directory of OpenSSL installation, and this `-sys` crate cannot
109-
proceed without this knowledge. If OpenSSL is installed and this crate had
110-
trouble finding it, you can set the `OPENSSL_DIR` environment variable for the
111-
compilation process.
119+
{}
112120
113121
Make sure you also have the development packages of openssl installed.
114122
For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
@@ -122,6 +130,7 @@ $TARGET = {}
122130
openssl-sys = {}
123131
124132
",
133+
msg_header,
125134
host,
126135
target,
127136
env!("CARGO_PKG_VERSION")
@@ -187,7 +196,8 @@ https://github.com/sfackler/rust-openssl#windows
187196
);
188197
}
189198

190-
panic!("{}", msg);
199+
eprintln!("{}", msg);
200+
std::process::exit(101); // same as panic previously
191201
}
192202

193203
/// Attempt to find OpenSSL through pkg-config.
@@ -212,7 +222,7 @@ fn try_pkg_config() {
212222
{
213223
Ok(lib) => lib,
214224
Err(e) => {
215-
println!("run pkg_config fail: {:?}", e);
225+
println!("\n\nCould not find openssl via pkg-config:\n{}\n", e);
216226
return;
217227
}
218228
};

0 commit comments

Comments
 (0)