Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dylni committed Aug 11, 2024
1 parent b601ef6 commit c6d429f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ Copies of third-party licenses can be found in [LICENSE-THIRD-PARTY].
[COPYRIGHT]: https://github.com/dylni/process_control/blob/master/COPYRIGHT
[documentation]: https://docs.rs/process_control
[LICENSE-APACHE]: https://github.com/dylni/process_control/blob/master/LICENSE-APACHE
[LICENSE-THIRD-PARTY]: https://github.com/dylni/process_control/blob/master/LICENSE-THIRD-PARTY
[src/unix/read.rs]: https://github.com/dylni/process_control/blob/master/src/unix/read.rs
[src/windows/read.rs]: https://github.com/dylni/process_control/blob/master/src/windows/read.rs
2 changes: 1 addition & 1 deletion src/control/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct Options {
}

pub trait Process {
type Result;
type Result: AsRef<ExitStatus>;

fn get(&mut self) -> &mut Child;

Expand Down
2 changes: 1 addition & 1 deletion src/unix/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! <https://thanks.rust-lang.org>
//!
//! <https://github.com/rust-lang/rust/blob/835ed0021e149cacb2d464cdbc35816b5d551c0e/COPYRIGHT>
//! - Modifications copyright (c) 2023 dylni (<https://github.com/dylni>)<br>
//! - Modifications copyright (c) 2024 dylni (<https://github.com/dylni>)<br>
//! <https://github.com/dylni/normpath/blob/master/COPYRIGHT>

use std::io;
Expand Down
7 changes: 4 additions & 3 deletions src/windows/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! <https://thanks.rust-lang.org>
//!
//! <https://github.com/rust-lang/rust/blob/835ed0021e149cacb2d464cdbc35816b5d551c0e/COPYRIGHT>
//! - Modifications copyright (c) 2023 dylni (<https://github.com/dylni>)<br>
//! - Modifications copyright (c) 2024 dylni (<https://github.com/dylni>)<br>
//! <https://github.com/dylni/normpath/blob/master/COPYRIGHT>

use std::io;
Expand Down Expand Up @@ -220,11 +220,12 @@ impl<'a> AsyncPipe<'a> {

impl Drop for AsyncPipe<'_> {
fn drop(&mut self) {
// Upon failure, overlapped IO operations may still be in progress, so
// leaking memory is required to ensure that pointers remain valid.
if self.reading
&& (self.inner.cancel_io().is_err() || self.result().is_err())
{
// Upon failure, overlapped IO operations may still be in progress,
// so leaking memory is required to ensure that pointers remain
// valid.
mem::forget(mem::take(self.buffer));
} else {
unsafe {
Expand Down

0 comments on commit c6d429f

Please sign in to comment.