Update test.rs · rust-lang/rust@a6ef91e (original) (raw)

Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ use std::env;
7 7 use std::ffi::OsStr;
8 8 use std::ffi::OsString;
9 9 use std::fs;
10 -use std::io::ErrorKind;
11 10 use std::iter;
12 11 use std::path::{Path, PathBuf};
13 12 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
1817 1816 cmd.arg("--gdb").arg(gdb);
1818 1817 }
1819 1818
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(|
1826 -.to_string()
1827 -})
1828 -};
1829 -
1830 1819 let lldb_exe = builder.config.lldb.clone().unwrap_or_else(|
1831 1820 let lldb_version = Command::new(&lldb_exe)
1832 1821 .arg("--version")
1833 1822 .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())
1836 1825 })
1837 -.map(|output
1838 -.ok();
1826 +.ok()
1827 +.and_then(|(output, success)
1839 1828 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(|
1835 +.to_string()
1836 +})
1837 +};
1840 1838 cmd.arg("--lldb-version").arg(vers);
1841 1839 let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
1842 1840 if let Some(ref dir) = lldb_python_dir {