Skip to content

Commit ce15106

Browse files
author
Charlie Somerville
committed
refactor eval_configure
1 parent 4e4d1ff commit ce15106

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

build.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::collections::HashSet;
55
use std::convert::AsRef;
66
use std::path::{PathBuf, Path};
77
use std::string::ToString;
8+
use std::process::Command;
89
use tar::Archive;
910
use flate2::read::GzDecoder;
1011

@@ -244,19 +245,15 @@ fn build() {
244245
configure_flags.push("--disable-debug");
245246
configure_flags.push("--disable-stripping");
246247
}
247-
let eval_configure = |flags: Vec<&str>| {
248-
let flags = flags.join(" ");
249-
std::process::Command::new("sh")
250-
.arg("-c")
251-
.arg(&format!(
252-
"cd {path} && ./configure {flags}",
253-
path=source_path.to_str().expect("PathBuf to str"),
254-
flags=flags,
255-
))
248+
249+
let eval_configure = |flags: &[&str]| {
250+
Command::new("./configure")
251+
.current_dir(&source_path)
252+
.args(flags)
256253
.output()
257-
.expect(&format!("ffmpeg configure script"))
254+
.expect("ffmpeg configure script")
258255
};
259-
let result = eval_configure(configure_flags.clone());
256+
let result = eval_configure(&configure_flags);
260257
if !result.status.success() {
261258
let stderr = String::from_utf8(result.stderr).expect("invalid str");
262259
let stdout = String::from_utf8(result.stdout).expect("invalid str");
@@ -267,7 +264,7 @@ fn build() {
267264
// MAYBE RETRY (USE CRIPPLED BUILD)
268265
if nasm_yasm_issue {
269266
configure_flags.push("--disable-x86asm");
270-
let result = eval_configure(configure_flags);
267+
let result = eval_configure(&configure_flags);
271268
if !result.status.success() {
272269
let stderr = String::from_utf8(result.stderr).expect("invalid str");
273270
let stdout = String::from_utf8(result.stdout).expect("invalid str");

0 commit comments

Comments
 (0)