tag | 6179a212efc123b3b45d03ce7e3a26c1fc4568a5 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Fri Feb 03 17:02:16 2023 -0800 |
object | bd2aaf615d8b7dca9c0440b3443417ffe19ed2ad |
Platform Tools Release 34.0.0 (9560563)
commit | bd2aaf615d8b7dca9c0440b3443417ffe19ed2ad | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 10:59:45 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Feb 01 10:59:45 2023 +0000 |
tree | 95ae6d3d23c33d4719bbd11a1b4fbbb3f260d6cd | |
parent | d9a4448110ec7949ec9db89b0699fe280114d9bf [diff] | |
parent | b0df4f9fb891f9319a64163b352f3586a26e6c6e [diff] |
Snap for 9550355 from b0df4f9fb891f9319a64163b352f3586a26e6c6e to sdk-release Change-Id: I0deaee47ae3333c43a864b0e33df51eceff5fb0c
A library for passing arbitrary file descriptors when spawning child processes.
use command_fds::{CommandFdExt, FdMapping}; use std::fs::File; use std::os::unix::io::AsRawFd; use std::process::Command; // Open a file. let file = File::open("Cargo.toml").unwrap(); // Prepare to run `ls -l /proc/self/fd` with some FDs mapped. let mut command = Command::new("ls"); command.arg("-l").arg("/proc/self/fd"); command .fd_mappings(vec![ // Map `file` as FD 3 in the child process. FdMapping { parent_fd: file.as_raw_fd(), child_fd: 3, }, // Map this process's stdin as FD 5 in the child process. FdMapping { parent_fd: 0, child_fd: 5, }, ]) .unwrap(); // Spawn the child process. let mut child = command.spawn().unwrap(); child.wait().unwrap();
Licensed under the Apache License, Version 2.0.
If you want to contribute to the project, see details of how we accept contributions.