summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Mayle <fmayle@google.com>2024-04-11 15:44:35 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-11 15:44:35 +0000
commit67cb0ae09de08ac99ce23a0ff5350f6c6e255bc4 (patch)
treeaf5f9597122d26749929f84f3408f0f5cafeb01c
parentca0547675ccfea3804cd5398f1a1be912d68c11d (diff)
parent9730181b66349545463d1bb54f45b1a565a57637 (diff)
downloaddevelopment-67cb0ae09de08ac99ce23a0ff5350f6c6e255bc4.tar.gz
Merge "Upgrade nix to 0.28.0" into main
-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 bf55ac217..024791222 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 {