Skip to content

Process should support the child outliving the parent #14467

Closed
@alexcrichton

Description

@alexcrichton

Current, Process invokes wait in its destructor to prevent leaking the child process for a long-running parent (see #13854 for discussion and more info). This does not support the use case of a child outliving the parent (such as creating a daemon).

A new method should be added to the Process type, perhaps detach, which consumes the Process and cancels the call to wait in the destructor. Something along the lines of:

// Forgets this process, allowing it to outlive the parent
//
// This function will forcefully prevent calling `wait()` on the child
// process in the destructor, allowing the child to outlive the 
// parent. Note that this operation can easily lead to leaking the
// resources of the child process, so care must be taken when
// invoking this method.
pub fn detach(self) { /* ... */ }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions