summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Mayle <fmayle@google.com>2024-04-09 12:06:29 -0700
committerFrederick Mayle <fmayle@google.com>2024-04-09 12:07:45 -0700
commit9730181b66349545463d1bb54f45b1a565a57637 (patch)
tree6d472e7607d40d19789ef034d927902cbf6ea029
parent1bcd0008b573931ed23b8b6619ed15f25aaf572d (diff)
downloaddevelopment-9730181b66349545463d1bb54f45b1a565a57637.tar.gz
Upgrade nix to 0.28.0
Bug: 333427576 Test: TreeHugger Change-Id: Id36458f8175c4bb7b6e85fa517705721db1b3d30
-rw-r--r--tools/cargo_embargo/src/main.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/tools/cargo_embargo/src/main.rs b/tools/cargo_embargo/src/main.rs
index f068368cd..d588feada 100644
--- a/tools/cargo_embargo/src/main.rs
+++ b/tools/cargo_embargo/src/main.rs
@@ -52,7 +52,6 @@ use std::collections::VecDeque;
use std::env;
use std::fs::{read_to_string, write, File};
use std::io::{Read, Write};
-use std::os::fd::{FromRawFd, OwnedFd};
use std::path::Path;
use std::path::PathBuf;
use std::process::{Command, Stdio};
@@ -379,7 +378,7 @@ fn write_all_bp(
/// Runs the given command, and returns its standard output and standard error as a string.
fn run_cargo(cmd: &mut Command) -> Result<String> {
- let (pipe_read, pipe_write) = pipe()?;
+ let (pipe_read, pipe_write) = pipe2(OFlag::O_CLOEXEC)?;
cmd.stdout(pipe_write.try_clone()?).stderr(pipe_write).stdin(Stdio::null());
debug!("Running: {:?}\n", cmd);
let mut child = cmd.spawn()?;
@@ -404,13 +403,6 @@ fn run_cargo(cmd: &mut Command) -> Result<String> {
Ok(output)
}
-/// Creates a new pipe and returns the file descriptors for each end of it.
-fn pipe() -> Result<(OwnedFd, OwnedFd), nix::Error> {
- let (a, b) = pipe2(OFlag::O_CLOEXEC)?;
- // SAFETY: We just created the file descriptors, so we own them.
- unsafe { Ok((OwnedFd::from_raw_fd(a), OwnedFd::from_raw_fd(b))) }
-}
-
/// The raw output from running `cargo metadata`, `cargo build` and other commands.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct CargoOutput {