Skip to content

Commit 27ea553

Browse files
authored
Update deps and add note to wait() (#22)
* Update deps * Add note to wait on cancel safety * Bump rust version
1 parent b88296f commit 27ea553

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- windows
1717
toolchain:
1818
- stable
19-
- 1.60.0
19+
- 1.68.0
2020
features:
2121
- default
2222
- with-tokio

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ readme = "README.md"
1414

1515
edition = "2021"
1616
exclude = ["/bin", "/.github"]
17-
rust-version = "1.60.0"
17+
rust-version = "1.68.0"
1818

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

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

2525
[dependencies.tokio]
26-
version = "1.10.0"
26+
version = "1.33.0"
2727
features = ["io-util", "macros", "process", "rt"]
2828
optional = true
2929

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ _Extension to [`Command`](https://doc.rust-lang.org/std/process/struct.Command.h
88

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

src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
#![doc = "\n"]
77
#![cfg_attr(
88
unix,
9-
doc = "On Unix, the [`UnixChildExt`] trait additionally provides"
10-
)]
11-
#![cfg_attr(
12-
unix,
13-
doc = "support for sending signals to processes and process groups (it’s implemented on this crate’s [`GroupChild`],"
9+
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`],"
1410
)]
1511
#![cfg_attr(
1612
all(unix, feature = "with-tokio"),

src/stdlib/child/unix.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
use std::{
22
convert::TryInto,
33
io::{Error, ErrorKind, Read, Result},
4-
os::unix::{
5-
io::{AsRawFd, RawFd},
6-
process::ExitStatusExt,
4+
os::{
5+
fd::BorrowedFd,
6+
unix::{
7+
io::{AsRawFd, RawFd},
8+
process::ExitStatusExt,
9+
},
710
},
811
process::{Child, ChildStderr, ChildStdin, ChildStdout, ExitStatus},
912
};
@@ -139,9 +142,13 @@ impl ChildImp {
139142
set_nonblocking(out_fd, true)?;
140143
set_nonblocking(err_fd, true)?;
141144

145+
// SAFETY: these are dropped at the same time as all other FDs here
146+
let out_bfd = unsafe { BorrowedFd::borrow_raw(out_fd) };
147+
let err_bfd = unsafe { BorrowedFd::borrow_raw(err_fd) };
148+
142149
let mut fds = [
143-
PollFd::new(out_fd, PollFlags::POLLIN),
144-
PollFd::new(err_fd, PollFlags::POLLIN),
150+
PollFd::new(&out_bfd, PollFlags::POLLIN),
151+
PollFd::new(&err_bfd, PollFlags::POLLIN),
145152
];
146153

147154
loop {

src/tokio/child.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ impl AsyncGroupChild {
207207
///
208208
/// See [the Tokio documentation](Child::wait) for more.
209209
///
210-
/// The current implementation spawns a blocking task on the Tokio thread pool; contributions
211-
/// are welcome for a more async-y version.
210+
/// The current implementation spawns a blocking task on the Tokio thread pool **and is not
211+
/// cancel-safe** (you shouldn't call it twice); contributions are welcome for a better version.
212212
///
213213
/// # Examples
214214
///

0 commit comments

Comments
 (0)