|
5 | 5 |
|
6 | 6 | use std::ffi::OsStr;
|
7 | 7 | use std::path::{Path, PathBuf};
|
8 |
| -use std::process::{Command, Stdio}; |
9 | 8 | use std::sync::OnceLock;
|
10 | 9 | use std::thread::panicking;
|
11 | 10 | use std::time::{Instant, SystemTime, UNIX_EPOCH};
|
12 | 11 | use std::{env, fs, io, panic, str};
|
13 | 12 |
|
14 |
| -use build_helper::util::fail; |
15 | 13 | use object::read::archive::ArchiveFile;
|
16 | 14 |
|
17 | 15 | use crate::LldMode;
|
@@ -282,33 +280,6 @@ pub fn make(host: &str) -> PathBuf {
|
282 | 280 | }
|
283 | 281 | }
|
284 | 282 |
|
285 |
| -/// Spawn a process and return a closure that will wait for the process |
286 |
| -/// to finish and then return its output. This allows the spawned process |
287 |
| -/// to do work without immediately blocking bootstrap. |
288 |
| -#[track_caller] |
289 |
| -pub fn start_process(cmd: &mut Command) -> impl FnOnce() -> String + use<> { |
290 |
| - let child = match cmd.stderr(Stdio::inherit()).stdout(Stdio::piped()).spawn() { |
291 |
| - Ok(child) => child, |
292 |
| - Err(e) => fail(&format!("failed to execute command: {cmd:?}\nERROR: {e}")), |
293 |
| - }; |
294 |
| - |
295 |
| - let command = format!("{cmd:?}"); |
296 |
| - |
297 |
| - move || { |
298 |
| - let output = child.wait_with_output().unwrap(); |
299 |
| - |
300 |
| - if !output.status.success() { |
301 |
| - panic!( |
302 |
| - "command did not execute successfully: {}\n\ |
303 |
| - expected success, got: {}", |
304 |
| - command, output.status |
305 |
| - ); |
306 |
| - } |
307 |
| - |
308 |
| - String::from_utf8(output.stdout).unwrap() |
309 |
| - } |
310 |
| -} |
311 |
| - |
312 | 283 | /// Returns the last-modified time for `path`, or zero if it doesn't exist.
|
313 | 284 | pub fn mtime(path: &Path) -> SystemTime {
|
314 | 285 | fs::metadata(path).and_then(|f| f.modified()).unwrap_or(UNIX_EPOCH)
|
|
0 commit comments