Skip to content

Commit a6ef91e

Browse files
committed
Update test.rs
1 parent fa12064 commit a6ef91e

File tree

1 file changed

+13
-15
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+13
-15
lines changed

src/bootstrap/src/core/build_steps/test.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use std::env;
77
use std::ffi::OsStr;
88
use std::ffi::OsString;
99
use std::fs;
10-
use std::io::ErrorKind;
1110
use std::iter;
1211
use std::path::{Path, PathBuf};
1312
use std::process::{Command, Stdio};
@@ -1817,26 +1816,25 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
18171816
cmd.arg("--gdb").arg(gdb);
18181817
}
18191818

1820-
let run = |cmd: &mut Command| {
1821-
cmd.output().map(|output| {
1822-
String::from_utf8_lossy(&output.stdout)
1823-
.lines()
1824-
.next()
1825-
.unwrap_or_else(|| panic!("{:?} failed {:?}", cmd, output))
1826-
.to_string()
1827-
})
1828-
};
1829-
18301819
let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|| PathBuf::from("lldb"));
18311820
let lldb_version = Command::new(&lldb_exe)
18321821
.arg("--version")
18331822
.output()
1834-
.and_then(|output| {
1835-
if output.status.success() { Ok(output) } else { Err(ErrorKind::Other.into()) }
1823+
.map(|output| {
1824+
(String::from_utf8_lossy(&output.stdout).to_string(), output.status.success())
18361825
})
1837-
.map(|output| String::from_utf8_lossy(&output.stdout).to_string())
1838-
.ok();
1826+
.ok()
1827+
.and_then(|(output, success)| if success { Some(output) } else { None });
18391828
if let Some(ref vers) = lldb_version {
1829+
let run = |cmd: &mut Command| {
1830+
cmd.output().map(|output| {
1831+
String::from_utf8_lossy(&output.stdout)
1832+
.lines()
1833+
.next()
1834+
.unwrap_or_else(|| panic!("{:?} failed {:?}", cmd, output))
1835+
.to_string()
1836+
})
1837+
};
18401838
cmd.arg("--lldb-version").arg(vers);
18411839
let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
18421840
if let Some(ref dir) = lldb_python_dir {

0 commit comments

Comments
 (0)