Skip to content

Commit acb3f6c

Browse files
committed
Merge branch 'master' into 3.1-merge
# Conflicts: # src/http-server/src/Response.php
2 parents b5038bb + b88631c commit acb3f6c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
189189

190190
$this->eventDispatcher->dispatch(new Event\FailToHandle($this, $exception));
191191
} finally {
192-
$this->eventDispatcher?->dispatch(new Event\AfterExecute($this));
192+
$this->eventDispatcher?->dispatch(new Event\AfterExecute($this, $exception ?? null));
193193
}
194194

195195
return $this->exitCode;

src/Event/AfterExecute.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
*/
1212
namespace Hyperf\Command\Event;
1313

14+
use Hyperf\Command\Command;
15+
use Throwable;
16+
1417
class AfterExecute extends Event
1518
{
19+
public function __construct(Command $command, protected ?Throwable $throwable = null)
20+
{
21+
parent::__construct($command);
22+
}
23+
24+
public function getThrowable(): ?Throwable
25+
{
26+
return $this->throwable;
27+
}
1628
}

0 commit comments

Comments
 (0)