tag | 406c6c4740531a0e0ca05c651d4bcbcc238e0935 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Mon Aug 22 14:18:31 2022 -0700 |
object | d9a4448110ec7949ec9db89b0699fe280114d9bf |
Platform Tools Release 33.0.3 (8952118)
commit | d9a4448110ec7949ec9db89b0699fe280114d9bf | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Aug 16 06:26:55 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Aug 16 06:26:55 2022 +0000 |
tree | 923042649ccc2e3043ba60e33bc5ecb477641783 | |
parent | 4b176b7be7855ac6c15820b1094fc2ee1e1a572b [diff] | |
parent | a2c77526ab24cda954e4314df235e2bd555ea2e3 [diff] |
Snap for 8952093 from a2c77526ab24cda954e4314df235e2bd555ea2e3 to sdk-release Change-Id: Ia6911b654639391190a6515b94370d0263223869
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.