Skip to content

Commit

Permalink
Update deps and add note to wait() (#22)
Browse files Browse the repository at this point in the history
* Update deps

* Add note to wait on cancel safety

* Bump rust version
  • Loading branch information
passcod authored Oct 29, 2023
1 parent b88296f commit 27ea553
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- windows
toolchain:
- stable
- 1.60.0
- 1.68.0
features:
- default
- with-tokio
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ readme = "README.md"

edition = "2021"
exclude = ["/bin", "/.github"]
rust-version = "1.60.0"
rust-version = "1.68.0"

# there are a few windows-specific ones
autoexamples = false

[dependencies]
async-trait = { version = "0.1.50", optional = true }
async-trait = { version = "0.1.74", optional = true }

[dependencies.tokio]
version = "1.10.0"
version = "1.33.0"
features = ["io-util", "macros", "process", "rt"]
optional = true

[target.'cfg(unix)'.dependencies.nix]
version = "0.26.1"
version = "0.27.1"
default-features = false
features = ["fs", "poll", "signal"]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Extension to [`Command`](https://doc.rust-lang.org/std/process/struct.Command.h

- **[API documentation][docs]**.
- [Dual-licensed][copyright] with Apache 2.0 and MIT.
- Minimum Supported Rust Version: 1.60.0.
- Minimum Supported Rust Version: 1.68.0.
- Only the last five stable versions are supported.
- MSRV increases within that range at publish time will not incur major version bumps.

Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
#![doc = "\n"]
#![cfg_attr(
unix,
doc = "On Unix, the [`UnixChildExt`] trait additionally provides"
)]
#![cfg_attr(
unix,
doc = "support for sending signals to processes and process groups (it’s implemented on this crate’s [`GroupChild`],"
doc = "On Unix, the [`UnixChildExt`] trait additionally provides support for sending signals to processes and process groups (it’s implemented on this crate’s [`GroupChild`],"
)]
#![cfg_attr(
all(unix, feature = "with-tokio"),
Expand Down
17 changes: 12 additions & 5 deletions src/stdlib/child/unix.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::{
convert::TryInto,
io::{Error, ErrorKind, Read, Result},
os::unix::{
io::{AsRawFd, RawFd},
process::ExitStatusExt,
os::{
fd::BorrowedFd,
unix::{
io::{AsRawFd, RawFd},
process::ExitStatusExt,
},
},
process::{Child, ChildStderr, ChildStdin, ChildStdout, ExitStatus},
};
Expand Down Expand Up @@ -139,9 +142,13 @@ impl ChildImp {
set_nonblocking(out_fd, true)?;
set_nonblocking(err_fd, true)?;

// SAFETY: these are dropped at the same time as all other FDs here
let out_bfd = unsafe { BorrowedFd::borrow_raw(out_fd) };
let err_bfd = unsafe { BorrowedFd::borrow_raw(err_fd) };

let mut fds = [
PollFd::new(out_fd, PollFlags::POLLIN),
PollFd::new(err_fd, PollFlags::POLLIN),
PollFd::new(&out_bfd, PollFlags::POLLIN),
PollFd::new(&err_bfd, PollFlags::POLLIN),
];

loop {
Expand Down
4 changes: 2 additions & 2 deletions src/tokio/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ impl AsyncGroupChild {
///
/// See [the Tokio documentation](Child::wait) for more.
///
/// The current implementation spawns a blocking task on the Tokio thread pool; contributions
/// are welcome for a more async-y version.
/// The current implementation spawns a blocking task on the Tokio thread pool **and is not
/// cancel-safe** (you shouldn't call it twice); contributions are welcome for a better version.
///
/// # Examples
///
Expand Down

0 comments on commit 27ea553

Please sign in to comment.