commit | e9e2acf90649702adccfe75dc6443be704424969 | [log] [tgz] |
---|---|---|
author | Karsten Tausche <karsten@fairphone.com> | Wed Dec 07 09:05:29 2022 +0100 |
committer | Karsten Tausche <karsten@fairphone.com> | Wed Dec 07 09:05:29 2022 +0100 |
tree | 5010dfb78a2e59c87c8880ee271516ba00c7e977 | |
parent | b0fa42eea9de6f44abbb05bbe95f2e410b0de6e9 [diff] | |
parent | 6a07495f89cd09f3d5a8f9e6ee6cbe1acf9a8a07 [diff] |
Merge tag 'android-13.0.0_r16' into int/13/fp3 Android 13.0.0 Release 16 (TQ1A.221205.011) * tag 'android-13.0.0_r16': Change-Id: Ib6fa27c7b233ac21df2e71cfa2e4b4c1874a35cc
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.