Skip to content
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

#31 restart process #32

Closed
wants to merge 3 commits into from
Closed

Conversation

Ekstazi
Copy link
Contributor

@Ekstazi Ekstazi commented Dec 6, 2018

Related to #31

Copy link
Member

@kelunik kelunik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether I like restarting directly in the same instance, but the patch looks really simple. Maybe restart should return a new instance?

lib/Process.php Outdated
return $this->processRunner->join($this->handle);
return call(function () {
$result = yield $this->processRunner->join($this->handle);
$this->handle = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to reset the PID as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now restart return new instance

@Ekstazi
Copy link
Contributor Author

Ekstazi commented Dec 7, 2018

Main purpose of restart is to use it in amphp/parallel#64.
I'll provide pull request soon.

@trowski
Copy link
Member

trowski commented Dec 7, 2018

I'm not sure if this method makes sense or is necessary. No functionality is being added. Additionally, the method hides what is really happening behind a boolean argument – true means kill the process and start a new process, while false means wait for the process to exit normally and then start a new process.

@trowski
Copy link
Member

trowski commented Jan 15, 2019

Closing for the reasons outlined above. If we want to create a new, identical Process object, perhaps we should look at implementing __clone or a duplicate method that returns a new, un-started process with the same configuration.

@trowski trowski closed this Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants