Implement send_signal for unix child processes#141990
Conversation
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use |
|
cc @tgross35 as this modifies the proposed API slightly - fn send_signal(&self, signal: i32) -> Result<()>;
+ fn send_signal(&mut self, signal: i32) -> Result<()>; |
|
I didn't put too much thought into what I wrote there, so it's fine if it needs to change. That being said, why does this need to be @Qelxiros could you add documentation and examples here? |
|
You're right that it doesn't need to be mutable, so I changed it back. I do wonder why e.g. |
|
No it's not to do with Windows. It seems to have been a deliberate decision in the early days of rust, though I can't find any record of the thinking behind it. It was implemented in #22119 and all the implementations use |
|
@tgross35 could you add an unresolved question to the tracking issue regarding & vs &mut? I want to make sure it doesn't get forgotten before stabilization. |
Added. I think this implementation looks fine, just needs a squash (I'll let Chris do the final review) |
|
@rustbot ready |
149dd21 to
269ee72
Compare
|
Thanks! @bors r+ |
…r=ChrisDenton Implement send_signal for unix child processes Tracking issue: rust-lang#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`.
Rollup of 7 pull requests Successful merges: - #138237 (Get rid of `EscapeDebugInner`.) - #140809 (Reduce special casing for the panic runtime) - #141990 (Implement send_signal for unix child processes) - #142082 (Refactor `rustc_attr_data_structures` documentation) - #142125 (Stabilize "file_lock" feature) - #142528 (clarify `rustc_do_not_const_check` comment) - #142530 (use `if let` guards where possible) r? `@ghost` `@rustbot` modify labels: rollup
|
@bors r- Failed the rollup at #142558 (comment). You'll need to make sure that all OSs in https://github.com/rust-lang/rust/tree/269ee72c330c21a9e0526e69fc0f85d762043d2d/library/std/src/sys/process/unix / https://github.com/rust-lang/rust/tree/68ac5abb067806a88464ddbfbd3c7eec877b488d/library/std/src/sys/process/unix have an implementation. |
|
|
||
| pub fn send_signal(&mut self) -> io::Result<()> { | ||
| // Fuchsia doesn't have a direct equivalent for signals | ||
| unimplemented!() |
There was a problem hiding this comment.
Cc target maintainers @erickt @Nashenas88 just to double check there isn't something that makes sense here (nonblocking for this PR)
There was a problem hiding this comment.
Fuchsia and unsupported need a _signal: i32 argument to match the other signatures
There was a problem hiding this comment.
Correct, fuchsia does not support signals. Thanks for checking!
|
Thanks! @bors r=ChrisDenton,tgross35 |
…r=ChrisDenton,tgross35 Implement send_signal for unix child processes Tracking issue: rust-lang#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
Rollup of 6 pull requests Successful merges: - #141990 (Implement send_signal for unix child processes) - #142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - #142502 (rustdoc_json: improve handling of generic args) - #142629 (Add config builder for bootstrap tests) - #142687 (Reduce uses of `hir_crate`.) - #142714 (add comment to `src/bootstrap/build.rs`) r? `@ghost` `@rustbot` modify labels: rollup
…r=ChrisDenton,tgross35 Implement send_signal for unix child processes Tracking issue: rust-lang#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
Rollup of 10 pull requests Successful merges: - #138291 (rewrite `optimize` attribute to use new attribute parsing infrastructure) - #141990 (Implement send_signal for unix child processes) - #142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.) - #142478 (install docs for each target in different directory) - #142571 (Reason about borrowed classes in CopyProp.) - #142668 (vec_deque/fmt/vec tests: remove static mut) - #142687 (Reduce uses of `hir_crate`.) - #142690 (expand: Remove some unnecessary generic parameters) - #142699 (Update books) - #142714 (add comment to `src/bootstrap/build.rs`) Failed merges: - #142502 (rustdoc_json: improve handling of generic args) r? `@ghost` `@rustbot` modify labels: rollup
…r=ChrisDenton,tgross35 Implement send_signal for unix child processes Tracking issue: rust-lang#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
Rollup of 8 pull requests Successful merges: - #138291 (rewrite `optimize` attribute to use new attribute parsing infrastructure) - #140920 (Extract some shared code from codegen backend target feature handling) - #141990 (Implement send_signal for unix child processes) - #142597 (error on calls to ABIs that cannot be called) - #142668 (vec_deque/fmt/vec tests: remove static mut) - #142687 (Reduce uses of `hir_crate`.) - #142699 (Update books) - #142714 (add comment to `src/bootstrap/build.rs`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - #138291 (rewrite `optimize` attribute to use new attribute parsing infrastructure) - #140920 (Extract some shared code from codegen backend target feature handling) - #141990 (Implement send_signal for unix child processes) - #142668 (vec_deque/fmt/vec tests: remove static mut) - #142687 (Reduce uses of `hir_crate`.) - #142699 (Update books) - #142714 (add comment to `src/bootstrap/build.rs`) - #142753 (Update library dependencies) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #141990 - Qelxiros:141975-unix_send_signal, r=ChrisDenton,tgross35 Implement send_signal for unix child processes Tracking issue: #141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
…t, r=Mark-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang#141990 so update here; signaling -> sending signals to because the latter reads better to me.
…t, r=Mark-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang#141990 so update here; signaling -> sending signals to because the latter reads better to me.
…t, r=Mark-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang#141990 so update here; signaling -> sending signals to because the latter reads better to me.
…t, r=Mark-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang#141990 so update here; signaling -> sending signals to because the latter reads better to me.
…t, r=Mark-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang#141990 so update here; signaling -> sending signals to because the latter reads better to me.
…-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang/rust#141990 so update here; signaling -> sending signals to because the latter reads better to me.
…r=ChrisDenton,tgross35 Implement send_signal for unix child processes Tracking issue: rust-lang#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
…t, r=Mark-Simulacrum update internal `send_signal` comment the vxwork did not have the old comment updated in rust-lang#141990 so update here; signaling -> sending signals to because the latter reads better to me.
Tracking issue: #141975
There are two main differences between my implementation and the Public API section of the tracking issue.
First,Second,send_signalrequires a mutable reference, likeChild::kill.ChildExthasSealedas a supertrait, bringing it more in line with other extension traits likeCommandExt.try-job:
dist-various*try-job:
test-various*