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

Add stop() method to Process and Pool #52959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Illuminate/Process/InvokedProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ public function signal(int $signal)
return $this;
}

/**
* Stop the process if it is still running.
*
* @param float $timeout
* @param int|null $signal
*
* @return int|null
*/
public function stop(float $timeout = 10, ?int $signal = null)
{
return $this->process->stop($timeout, $signal);
}

/**
* Determine if the process is still running.
*
Expand Down
13 changes: 13 additions & 0 deletions src/Illuminate/Process/InvokedProcessPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ public function signal(int $signal)
return $this->running()->each->signal($signal);
}

/**
* Stop all processes that are still running
*
* @param float $timeout
* @param int|null $signal
*
* @return \Illuminate\Support\Collection
*/
public function stop(float $timeout = 10, ?int $signal = null)
{
return $this->running()->each->stop($timeout, $signal);
}

/**
* Get the processes in the pool that are still currently running.
*
Expand Down
Loading