how to use events in cli?

hi. Can somebody help to understand how use events in cli? for both console:beforeHandleTask and console:afterHandleTask. I write so

$app = new Console();

$eventsManager = $di->getShared('eventsManager');
$eventsManager->attach('console:beforeHandleTask', new CliPlugin());
$eventsManager->attach('console:afterHandleTask', new CliPlugin());


beforeHandleTask fires, but afterHandleTask no. Where is my error?

Does your CLI task exit/die/terminate in any way that wouldn't allow the bootstrapping to complete gracefully? You can see in the Zephir code that the event is definitely there to be fired:

Which version of Phalcon are you running, and on what architecture?