-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process: misc improvements #1371
Comments
Assigning this to myself to review/drive, but any tasks are up for grabs by anyone interested! (feel free to ping me for reviews or ideas!) |
I would recommend avoiding the This is the strategy we take in tokio-fs. |
@carllerche makes sense to me! It will also give us a smaller API surface we can evolve as needed (in retrospect trying to make the async command fit all of the |
Can I jump in and comment on tokio-process usage? It's a little awkward right now for handling an ending process. Right now, you can If there was another concept, like a Edit: here's a way it could look. let handle = child.signal_handle();
tokio::spawn(async move {
let _ = child.await;
// do whatever after process finishes
});
tokio::spawn(async move {
something.await; // react to some event
handle.send_signal(Signal::Kill).await;
}); |
Unfortunately, because async Command does not share anything with std::process::Command anymore, unix-specific capabilities (uid, gid, pre_exec, exec) are now unavailable. Also it how complicated will it be to allow to receive completion notifications from Handle/Pid created by other means (i.e. direct use of fork, external libs)? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Extensions have now been added!
We rely on Do you have a more specific use case for what functionality you're looking for? |
Great! Thank you! What is your opinion on making exec also available for unix? Technically it is not a blocking call, but will allow to choose between exec into new process or performing non-blocking wait while keeping child initialization procedure the same.
These cases are likely to be platform-specific:
I understand that there is no way to keep safety guarantees and also keep it cross-platform. It seems the question moves into defining the scope of public API (i.e. whether to make Reaper public), so user will be able to reuse global state defined in the library. This might conflict with using Jobs on Windows though. So specific cases might require custom watchers. |
Although it's a more advanced/here-be-dragons type of API, I would personally be okay with adding a method which delegates to
Let me first start by saying that we'd be happy to consider any concrete proposals for API additions if they have sufficient motivation! My thoughts on the matter are:
|
I'm going to resolve this tracking issue since I believe we have all the breaking API changes in the state that we want them for the For any outstanding feature requests (which do not require breaking changes), please feel free to open a new issue, and we can track the discussion there! |
Tracking misc smaller improvements to
tokio-process
.This issue is to be closed once there are no remaining breaking changes to make or remaining breaking changes are tracked in separate issues.
Update to
std::future
Polish
CommandExt
trait in favor of aprocess::Command
wrapper (similar to whattokio-fs
does) (tokio-process: change CommandExt to a fully asynchronous Command struct #1448)Child
future[ ] Update CHANGELOG with all changes since the previous versionRe-export
[ ] consider re-exportingtokio_process::CommandExt
astokio::process::CommandExt
The text was updated successfully, but these errors were encountered: