@@ -52,7 +52,6 @@ use std::collections::VecDeque;
52
52
use std:: env;
53
53
use std:: fs:: { read_to_string, write, File } ;
54
54
use std:: io:: { Read , Write } ;
55
- use std:: os:: fd:: { FromRawFd , OwnedFd } ;
56
55
use std:: path:: Path ;
57
56
use std:: path:: PathBuf ;
58
57
use std:: process:: { Command , Stdio } ;
@@ -379,7 +378,7 @@ fn write_all_bp(
379
378
380
379
/// Runs the given command, and returns its standard output and standard error as a string.
381
380
fn run_cargo ( cmd : & mut Command ) -> Result < String > {
382
- let ( pipe_read, pipe_write) = pipe ( ) ?;
381
+ let ( pipe_read, pipe_write) = pipe2 ( OFlag :: O_CLOEXEC ) ?;
383
382
cmd. stdout ( pipe_write. try_clone ( ) ?) . stderr ( pipe_write) . stdin ( Stdio :: null ( ) ) ;
384
383
debug ! ( "Running: {:?}\n " , cmd) ;
385
384
let mut child = cmd. spawn ( ) ?;
@@ -404,13 +403,6 @@ fn run_cargo(cmd: &mut Command) -> Result<String> {
404
403
Ok ( output)
405
404
}
406
405
407
- /// Creates a new pipe and returns the file descriptors for each end of it.
408
- fn pipe ( ) -> Result < ( OwnedFd , OwnedFd ) , nix:: Error > {
409
- let ( a, b) = pipe2 ( OFlag :: O_CLOEXEC ) ?;
410
- // SAFETY: We just created the file descriptors, so we own them.
411
- unsafe { Ok ( ( OwnedFd :: from_raw_fd ( a) , OwnedFd :: from_raw_fd ( b) ) ) }
412
- }
413
-
414
406
/// The raw output from running `cargo metadata`, `cargo build` and other commands.
415
407
#[ derive( Clone , Debug , Eq , PartialEq ) ]
416
408
pub struct CargoOutput {
0 commit comments