8000 minor #57514 Double check if pcntl function exists (Toflar) · symfony/symfony@10514a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 10514a6

Browse files
minor #57514 Double check if pcntl function exists (Toflar)
This PR was merged into the 6.4 branch. Discussion ---------- Double check if pcntl function exists | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes| New feature? | no | Deprecations? | no | Issues | | License | MIT I have a system where we use the `kernel.terminate` event to trigger `messenger:consume` in case there's no real worker available. Which means there might be the case that when building the container on cli, `pcntl_signal_dispatch` exists but in the web process it of course doesn't. Super edge-case but these 3 lines would save me from implementing some logic to unregister this listener myself and I don't see why it would hurt anybody else. Commits ------- 765eceb Double check if pcntl function exists 8000
2 parents a26387b + 765eceb commit 10514a6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Component/Messenger/EventListener/DispatchPcntlSignalListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ class DispatchPcntlSignalListener implements EventSubscriberInterface
2121
{
2222
public function onWorkerRunning(): void
2323
{
24+
if (!\function_exists('pcntl_signal_dispatch')) {
25+
return;
26+
}
27+
2428
pcntl_signal_dispatch();
2529
}
2630

0 commit comments

Comments
 (0)
0