Skip to content

Commit e1f1cde

Browse files
Add stop() method to Process and Pool (#52959)
* feat: Add stop() convenience method to InvokedProcess * feat: Added stop() helper method to process pools as well * Update InvokedProcess.php * Update InvokedProcessPool.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent bb85cbe commit e1f1cde

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/Illuminate/Process/InvokedProcess.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ public function signal(int $signal)
5050
return $this;
5151
}
5252

53+
/**
54+
* Stop the process if it is still running.
55+
*
56+
* @param float $timeout
57+
* @param int|null $signal
58+
*
59+
* @return int|null
60+
*/
61+
public function stop(float $timeout = 10, ?int $signal = null)
62+
{
63+
return $this->process->stop($timeout, $signal);
64+
}
65+
5366
/**
5467
* Determine if the process is still running.
5568
*

src/Illuminate/Process/InvokedProcessPool.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ public function signal(int $signal)
3535
return $this->running()->each->signal($signal);
3636
}
3737

38+
/**
39+
* Stop all processes that are still running
40+
*
41+
* @param float $timeout
42+
* @param int|null $signal
43+
*
44+
* @return \Illuminate\Support\Collection
45+
*/
46+
public function stop(float $timeout = 10, ?int $signal = null)
47+
{
48+
return $this->running()->each->stop($timeout, $signal);
49+
}
50+
3851
/**
3952
* Get the processes in the pool that are still currently running.
4053
*

0 commit comments

Comments
 (0)