mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
No more follows-from for process
This commit is contained in:
parent
bf4c544df4
commit
e209a282d9
3 changed files with 15 additions and 17 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1347,7 +1347,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pict-rs"
|
name = "pict-rs"
|
||||||
version = "0.3.0-beta.10"
|
version = "0.3.0-beta.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-form-data",
|
"actix-form-data",
|
||||||
"actix-rt",
|
"actix-rt",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pict-rs"
|
name = "pict-rs"
|
||||||
description = "A simple image hosting service"
|
description = "A simple image hosting service"
|
||||||
version = "0.3.0-beta.10"
|
version = "0.3.0-beta.11"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -45,18 +45,22 @@ impl Process {
|
||||||
|
|
||||||
fn spawn_span(&self) -> Span {
|
fn spawn_span(&self) -> Span {
|
||||||
let span = tracing::info_span!(parent: None, "Spawned command writer",);
|
let span = tracing::info_span!(parent: None, "Spawned command writer",);
|
||||||
|
|
||||||
span.follows_from(self.span.clone());
|
span.follows_from(self.span.clone());
|
||||||
|
|
||||||
span
|
span
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(name = "Spawning Command")]
|
|
||||||
pub(crate) fn spawn(cmd: &mut Command) -> std::io::Result<Self> {
|
pub(crate) fn spawn(cmd: &mut Command) -> std::io::Result<Self> {
|
||||||
let cmd = cmd.stdin(Stdio::piped()).stdout(Stdio::piped());
|
let cmd = cmd.stdin(Stdio::piped()).stdout(Stdio::piped());
|
||||||
|
|
||||||
cmd.spawn().map(|child| Process {
|
let span = tracing::info_span!(
|
||||||
child,
|
"Spawning Command",
|
||||||
span: Span::current(),
|
command = &tracing::field::debug(&cmd),
|
||||||
})
|
exception.message = &tracing::field::Empty,
|
||||||
|
exception.details = &tracing::field::Empty,
|
||||||
|
);
|
||||||
|
cmd.spawn().map(|child| Process { child, span })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn wait(mut self) -> std::io::Result<()> {
|
pub(crate) async fn wait(mut self) -> std::io::Result<()> {
|
||||||
|
@ -100,7 +104,7 @@ impl Process {
|
||||||
|
|
||||||
Some(ProcessRead {
|
Some(ProcessRead {
|
||||||
inner: stdout,
|
inner: stdout,
|
||||||
span: body_span(self.span),
|
span: self.span,
|
||||||
err_recv: rx,
|
err_recv: rx,
|
||||||
err_closed: false,
|
err_closed: false,
|
||||||
handle: DropHandle { inner: handle },
|
handle: DropHandle { inner: handle },
|
||||||
|
@ -133,7 +137,7 @@ impl Process {
|
||||||
|
|
||||||
Some(ProcessRead {
|
Some(ProcessRead {
|
||||||
inner: stdout,
|
inner: stdout,
|
||||||
span: body_span(self.span),
|
span: self.span,
|
||||||
err_recv: rx,
|
err_recv: rx,
|
||||||
err_closed: false,
|
err_closed: false,
|
||||||
handle: DropHandle { inner: handle },
|
handle: DropHandle { inner: handle },
|
||||||
|
@ -177,7 +181,7 @@ impl Process {
|
||||||
|
|
||||||
Some(ProcessRead {
|
Some(ProcessRead {
|
||||||
inner: stdout,
|
inner: stdout,
|
||||||
span: body_span(self.span),
|
span: self.span,
|
||||||
err_recv: rx,
|
err_recv: rx,
|
||||||
err_closed: false,
|
err_closed: false,
|
||||||
handle: DropHandle { inner: handle },
|
handle: DropHandle { inner: handle },
|
||||||
|
@ -185,12 +189,6 @@ impl Process {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn body_span(following: Span) -> Span {
|
|
||||||
let span = tracing::info_span!(parent: None, "Processing Command");
|
|
||||||
span.follows_from(following);
|
|
||||||
span
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<I> AsyncRead for ProcessRead<I>
|
impl<I> AsyncRead for ProcessRead<I>
|
||||||
where
|
where
|
||||||
I: AsyncRead,
|
I: AsyncRead,
|
||||||
|
@ -202,10 +200,10 @@ where
|
||||||
) -> Poll<std::io::Result<()>> {
|
) -> Poll<std::io::Result<()>> {
|
||||||
let this = self.as_mut().project();
|
let this = self.as_mut().project();
|
||||||
|
|
||||||
|
let span = this.span;
|
||||||
let err_recv = this.err_recv;
|
let err_recv = this.err_recv;
|
||||||
let err_closed = this.err_closed;
|
let err_closed = this.err_closed;
|
||||||
let inner = this.inner;
|
let inner = this.inner;
|
||||||
let span = this.span;
|
|
||||||
|
|
||||||
span.in_scope(|| {
|
span.in_scope(|| {
|
||||||
if !*err_closed {
|
if !*err_closed {
|
||||||
|
|
Loading…
Reference in a new issue