Skip to content

Commit e7904ce

Browse files
committed
Create temporary directory in OUT_DIR
1 parent a769a1d commit e7904ce

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

build.rs

+11-13
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ mod common;
1515

1616
fn main() {
1717
let (work_dir, base) = if env::var("DOCS_RS").is_ok() {
18-
let tempdir = tempfile::tempdir().unwrap();
19-
let status = Command::new("git")
18+
let out_dir = env::var("OUT_DIR").unwrap();
19+
let tempdir = tempfile::tempdir_in(&out_dir).unwrap();
20+
let output = Command::new("git")
2021
.args(["clone", AFL_SRC_PATH, &*tempdir.path().to_string_lossy()])
21-
.status()
22+
.output()
2223
.expect("could not run 'git'");
23-
assert!(status.success());
24-
(
25-
tempdir.into_path(),
26-
Some(PathBuf::from(env::var("OUT_DIR").unwrap())),
27-
)
24+
assert!(output.status.success(), "{:#?}", output);
25+
(tempdir.into_path(), Some(PathBuf::from(out_dir)))
2826
} else {
2927
(PathBuf::from(AFL_SRC_PATH), None)
3028
};
@@ -46,8 +44,8 @@ fn build_afl(work_dir: &Path, base: Option<&Path>) {
4644
if std::env::var("DEBUG").as_deref() == Ok("false") {
4745
command.env_remove("DEBUG");
4846
}
49-
let status = command.status().expect("could not run 'make'");
50-
assert!(status.success());
47+
let output = command.output().expect("could not run 'make'");
48+
assert!(output.status.success(), "{:#?}", output);
5149
}
5250

5351
fn build_afl_llvm_runtime(work_dir: &Path, base: Option<&Path>) {
@@ -57,11 +55,11 @@ fn build_afl_llvm_runtime(work_dir: &Path, base: Option<&Path>) {
5755
)
5856
.expect("Couldn't copy object file");
5957

60-
let status = Command::new(AR_CMD)
58+
let output = Command::new(AR_CMD)
6159
.arg("r")
6260
.arg(common::archive_file_path(base))
6361
.arg(common::object_file_path(base))
64-
.status()
62+
.output()
6563
.expect("could not run 'ar'");
66-
assert!(status.success());
64+
assert!(output.status.success(), "{:#?}", output);
6765
}

0 commit comments

Comments
 (0)