Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tokio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ This fixes a regression on the wasm32-unknown-unknown target, where code that
previously did not panic due to calls to `Instant::now()` started failing. This
is due to the stabilization of the first time-based metric.

### Added

- process: Implement `TryFrom<std::process::Child>` for `tokio::process::Child` ([#7388])

[#7388]: https://github.com/tokio-rs/tokio/pull/7388

### Fixed

- Disable time-based metrics on wasm32-unknown-unknown ([#7322])
Expand Down
18 changes: 18 additions & 0 deletions tokio/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,24 @@ pub struct Child {
pub stderr: Option<ChildStderr>,
}

impl TryFrom<StdChild> for Child {
type Error = io::Error;

fn try_from(value: StdChild) -> io::Result<Self> {
let spawned_child = imp::build_child(value)?;

Ok(Child {
child: FusedChild::Child(ChildDropGuard {
inner: spawned_child.child,
kill_on_drop: false,
}),
stdin: spawned_child.stdin.map(|inner| ChildStdin { inner }),
stdout: spawned_child.stdout.map(|inner| ChildStdout { inner }),
stderr: spawned_child.stderr.map(|inner| ChildStderr { inner }),
})
}
}

impl Child {
/// Returns the OS-assigned process identifier associated with this child
/// while it is still running.
Expand Down