Skip to content

Commit 3acaa08

Browse files
authored
fix: signal registration for windows (#72)
1 parent c0d8593 commit 3acaa08

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Compatibility/SignalTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,17 @@ protected function isPosixAvailable(): bool
104104
* @param array<int, string> $methodMap Optional signal-to-method mapping
105105
*/
106106
protected function registerSignals(
107-
array $signals = [SIGTERM, SIGINT, SIGHUP, SIGQUIT],
107+
array $signals = [],
108108
array $methodMap = [],
109109
): void {
110110
if (! $this->isPcntlAvailable()) {
111111
return;
112112
}
113113

114+
if ($signals === []) {
115+
$signals = [SIGTERM, SIGINT, SIGHUP, SIGQUIT];
116+
}
117+
114118
if (! $this->isPosixAvailable() && (in_array(SIGTSTP, $signals, true) || in_array(SIGCONT, $signals, true))) {
115119
CLI::write('POSIX extension is not available. SIGTSTP and SIGCONT signals will be disabled.', 'yellow');
116120
$signals = array_diff($signals, [SIGTSTP, SIGCONT]);

stubs/SignalTrait.phpstub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ trait SignalTrait
4242
* @param list<int> $signals
4343
* @param array<int, string> $methodMap
4444
*/
45-
protected function registerSignals(array $signals = [SIGTERM, SIGINT, SIGHUP, SIGQUIT], array $methodMap = []): void
45+
protected function registerSignals(array $signals = [], array $methodMap = []): void
4646
{
4747
}
4848

0 commit comments

Comments
 (0)