From ea943e81101c6ba6d36edd54234c24855b795647 Mon Sep 17 00:00:00 2001 From: Mathias Hansen Date: Fri, 27 Sep 2024 11:59:35 +0200 Subject: [PATCH 1/4] feat: Add stop() convenience method to InvokedProcess --- src/Illuminate/Process/InvokedProcess.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Illuminate/Process/InvokedProcess.php b/src/Illuminate/Process/InvokedProcess.php index 6f2a67095b0b..4cb6097f2074 100644 --- a/src/Illuminate/Process/InvokedProcess.php +++ b/src/Illuminate/Process/InvokedProcess.php @@ -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 The process exit code or null if the process is not running + */ + public function stop(float $timeout = 10, ?int $signal = null) + { + return $this->process->stop($timeout, $signal); + } + /** * Determine if the process is still running. * From 48ab00e9c02db02006a3d490ae150f292d58ac61 Mon Sep 17 00:00:00 2001 From: Mathias Hansen Date: Fri, 27 Sep 2024 12:06:18 +0200 Subject: [PATCH 2/4] feat: Added stop() helper method to process pools as well --- src/Illuminate/Process/InvokedProcess.php | 2 +- src/Illuminate/Process/InvokedProcessPool.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Process/InvokedProcess.php b/src/Illuminate/Process/InvokedProcess.php index 4cb6097f2074..14ad9454b878 100644 --- a/src/Illuminate/Process/InvokedProcess.php +++ b/src/Illuminate/Process/InvokedProcess.php @@ -54,7 +54,7 @@ public function signal(int $signal) * Stop the process if it is still running. * * @param float $timeout - * @param int|null $signal + * @param int|null $signal * * @return int|null The process exit code or null if the process is not running */ diff --git a/src/Illuminate/Process/InvokedProcessPool.php b/src/Illuminate/Process/InvokedProcessPool.php index 29f8a6579bb5..b00e97061b36 100644 --- a/src/Illuminate/Process/InvokedProcessPool.php +++ b/src/Illuminate/Process/InvokedProcessPool.php @@ -35,6 +35,19 @@ public function signal(int $signal) return $this->running()->each->signal($signal); } + /** + * Stops 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. * From 179f67f8cf6242f53e7cf285600c1ca2e03e0c8a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 27 Sep 2024 10:34:42 -0400 Subject: [PATCH 3/4] Update InvokedProcess.php --- src/Illuminate/Process/InvokedProcess.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Process/InvokedProcess.php b/src/Illuminate/Process/InvokedProcess.php index 14ad9454b878..888b7957e17d 100644 --- a/src/Illuminate/Process/InvokedProcess.php +++ b/src/Illuminate/Process/InvokedProcess.php @@ -56,7 +56,7 @@ public function signal(int $signal) * @param float $timeout * @param int|null $signal * - * @return int|null The process exit code or null if the process is not running + * @return int|null */ public function stop(float $timeout = 10, ?int $signal = null) { From a68d8ccfca668f6d0a5c1698535b14d53cdcd65e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 27 Sep 2024 10:35:06 -0400 Subject: [PATCH 4/4] Update InvokedProcessPool.php --- src/Illuminate/Process/InvokedProcessPool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Process/InvokedProcessPool.php b/src/Illuminate/Process/InvokedProcessPool.php index b00e97061b36..318963168716 100644 --- a/src/Illuminate/Process/InvokedProcessPool.php +++ b/src/Illuminate/Process/InvokedProcessPool.php @@ -36,7 +36,7 @@ public function signal(int $signal) } /** - * Stops all processes that are still running + * Stop all processes that are still running * * @param float $timeout * @param int|null $signal