Skip to content
Merged
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
10 changes: 7 additions & 3 deletions src/Wrep/Daemonizable/Command/EndlessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public function __construct(?string $name = null)
$this->addOption('run-once', null, InputOption::VALUE_NONE,
'Run the command just once, do not go into an endless loop');
$this->addOption('detect-leaks', null, InputOption::VALUE_NONE, 'Output information about memory usage');
}

// Set our runloop as the executable code
parent::setCode([$this, 'runloop']);
public function __invoke(InputInterface $input, OutputInterface $output): int
{
return $this->runloop($input, $output);
}

/**
Expand Down Expand Up @@ -78,7 +80,7 @@ public function run(InputInterface $input, OutputInterface $output): int
*
* @param int $signal The signal code to handle
*/
public function handleSignal(int $signal): void
public function handleSignal(int $signal, array|int|false $previousExitCode = 0): int|false
Copy link
Contributor Author

@umpirsky umpirsky May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added array here because of:

1) Tests\Wrep\Daemonizable\Command\EndlessCommandTest::testInterruptSigtermFromDifferentContext
TypeError: Wrep\Daemonizable\Command\EndlessCommand::handleSignal(): Argument #2 ($previousExitCode) must be of type int|false, array given, called in tests/Wrep/Daemonizable/Command/EndlessCommandTest.php on line 117

src/Wrep/Daemonizable/Command/EndlessCommand.php:83
tests/Wrep/Daemonizable/Command/EndlessCommandTest.php:117
vendor/symfony/console/Command/Command.php:318
src/Wrep/Daemonizable/Command/EndlessCommand.php:75
tests/Wrep/Daemonizable/Command/EndlessCommandTest.php:102

Soemthing that should probably be addressed later on.

{
switch ($signal) {
// Shutdown signals
Expand All @@ -87,6 +89,8 @@ public function handleSignal(int $signal): void
$this->shutdown();
break;
}

return false;
}

/**
Expand Down