mirror of
https://github.com/servo/servo.git
synced 2025-08-15 02:15:33 +01:00
build(deps): bump nix from 0.29.0 to 0.30.1 (#38650)
Bumps [nix](https://github.com/nix-rust/nix) from 0.29.0 to 0.30.1. - [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md) - [Commits](https://github.com/nix-rust/nix/compare/v0.29.0...v0.30.1) Closes: #38145 Testing: Covered by existing tests Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
parent
069ad40872
commit
d0d952d1fa
3 changed files with 18 additions and 11 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -687,7 +687,7 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"mach2",
|
"mach2",
|
||||||
"nix 0.29.0",
|
"nix 0.30.1",
|
||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
@ -7773,7 +7773,7 @@ dependencies = [
|
||||||
"napi-ohos",
|
"napi-ohos",
|
||||||
"net",
|
"net",
|
||||||
"net_traits",
|
"net_traits",
|
||||||
"nix 0.29.0",
|
"nix 0.30.1",
|
||||||
"objc2-app-kit 0.3.1",
|
"objc2-app-kit 0.3.1",
|
||||||
"objc2-foundation 0.3.1",
|
"objc2-foundation 0.3.1",
|
||||||
"ohos-abilitykit-sys",
|
"ohos-abilitykit-sys",
|
||||||
|
|
|
@ -106,7 +106,7 @@ mime = "0.3.13"
|
||||||
mime_guess = "2.0.5"
|
mime_guess = "2.0.5"
|
||||||
mozangle = "0.5.3"
|
mozangle = "0.5.3"
|
||||||
net_traits = { path = "components/shared/net" }
|
net_traits = { path = "components/shared/net" }
|
||||||
nix = "0.29"
|
nix = "0.30"
|
||||||
nom = "8.0.0"
|
nom = "8.0.0"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
num_cpus = "1.17.0"
|
num_cpus = "1.17.0"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! Helper Module to redirect stdout/stderr to the logging sink
|
//! Helper Module to redirect stdout/stderr to the logging sink
|
||||||
|
|
||||||
use std::os::fd::{AsRawFd, IntoRawFd, RawFd};
|
use std::os::fd::{IntoRawFd, RawFd};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
|
@ -34,12 +34,19 @@ pub(crate) fn redirect_stdout_and_stderr() -> Result<(), LogRedirectError> {
|
||||||
// The first step is to redirect stdout and stderr to the logs.
|
// The first step is to redirect stdout and stderr to the logs.
|
||||||
// We redirect stdout and stderr to a custom descriptor.
|
// We redirect stdout and stderr to a custom descriptor.
|
||||||
let (readerfd, writerfd) = nix::unistd::pipe().map_err(LogRedirectError::CreatePipeFailed)?;
|
let (readerfd, writerfd) = nix::unistd::pipe().map_err(LogRedirectError::CreatePipeFailed)?;
|
||||||
// Leaks the writer fd. We want to log for the whole program lifetime.
|
// SAFETY: `writerfd`, `fd1` and `fd2` are all `OwnedFd`s for the same file.
|
||||||
let raw_writerfd = writerfd.into_raw_fd();
|
// We take care to leak all 3 of them to ensure the writerfd is not closed, and thus
|
||||||
let _fd = nix::unistd::dup2(raw_writerfd, RawFd::from(1))
|
// naturally also prevent double closes.
|
||||||
.map_err(LogRedirectError::RedirectToPipeFailed)?;
|
unsafe {
|
||||||
let _fd = nix::unistd::dup2(raw_writerfd, RawFd::from(2))
|
let fd1 = nix::unistd::dup2_raw(&writerfd, RawFd::from(1))
|
||||||
.map_err(LogRedirectError::RedirectToPipeFailed)?;
|
.map_err(LogRedirectError::RedirectToPipeFailed)?;
|
||||||
|
let fd2 = nix::unistd::dup2_raw(&writerfd, RawFd::from(2))
|
||||||
|
.map_err(LogRedirectError::RedirectToPipeFailed)?;
|
||||||
|
// Leaks the writer fds. We want to log for the whole program lifetime.
|
||||||
|
let _ = writerfd.into_raw_fd();
|
||||||
|
let _ = fd1.into_raw_fd();
|
||||||
|
let _ = fd2.into_raw_fd();
|
||||||
|
}
|
||||||
|
|
||||||
// Then we spawn a thread whose only job is to read from the other side of the
|
// Then we spawn a thread whose only job is to read from the other side of the
|
||||||
// pipe and redirect to the logs.
|
// pipe and redirect to the logs.
|
||||||
|
@ -52,7 +59,7 @@ pub(crate) fn redirect_stdout_and_stderr() -> Result<(), LogRedirectError> {
|
||||||
loop {
|
loop {
|
||||||
let result = {
|
let result = {
|
||||||
let read_into = &mut buf[cursor..];
|
let read_into = &mut buf[cursor..];
|
||||||
nix::unistd::read(readerfd.as_raw_fd(), read_into)
|
nix::unistd::read(&readerfd, read_into)
|
||||||
};
|
};
|
||||||
|
|
||||||
let end = match result {
|
let end = match result {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue