Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 67cb0ae

Browse files
fkm3Gerrit Code Review
authored and
Gerrit Code Review
committed
Merge "Upgrade nix to 0.28.0" into main
2 parents ca05476 + 9730181 commit 67cb0ae

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

tools/cargo_embargo/src/main.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ use std::collections::VecDeque;
5252
use std::env;
5353
use std::fs::{read_to_string, write, File};
5454
use std::io::{Read, Write};
55-
use std::os::fd::{FromRawFd, OwnedFd};
5655
use std::path::Path;
5756
use std::path::PathBuf;
5857
use std::process::{Command, Stdio};
@@ -379,7 +378,7 @@ fn write_all_bp(
379378

380379
/// Runs the given command, and returns its standard output and standard error as a string.
381380
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)?;
383382
cmd.stdout(pipe_write.try_clone()?).stderr(pipe_write).stdin(Stdio::null());
384383
debug!("Running: {:?}\n", cmd);
385384
let mut child = cmd.spawn()?;
@@ -404,13 +403,6 @@ fn run_cargo(cmd: &mut Command) -> Result<String> {
404403
Ok(output)
405404
}
406405

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-
414406
/// The raw output from running `cargo metadata`, `cargo build` and other commands.
415407
#[derive(Clone, Debug, Eq, PartialEq)]
416408
pub struct CargoOutput {

0 commit comments

Comments
 (0)