Fix
This commit is contained in:
parent
24b92b9a71
commit
954c64127e
@ -173,8 +173,12 @@ class API extends APIFactory
|
||||
if ($this->asyncInitPromise) {
|
||||
$this->init();
|
||||
}
|
||||
$this->API->logger('Shutting down MadelineProto (normally or due to an exception, idk)');
|
||||
$this->API->destructing = true;
|
||||
if ($this->API) {
|
||||
$this->API->logger('Shutting down MadelineProto (normally or due to an exception, idk)');
|
||||
$this->API->destructing = true;
|
||||
} else {
|
||||
Logger::log('Shutting down MadelineProto (normally or due to an exception, idk)');
|
||||
}
|
||||
$this->destructing = true;
|
||||
$this->wait($this->serialize());
|
||||
//restore_error_handler();
|
||||
|
@ -20,6 +20,7 @@
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
use function Amp\Promise\wait;
|
||||
use Amp\Loop;
|
||||
|
||||
class Magic
|
||||
{
|
||||
@ -130,9 +131,9 @@ class Magic
|
||||
self::$can_getcwd = true;
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
}
|
||||
if (function_exists('\pcntl_async_signals')) {
|
||||
pcntl_async_signals(true);
|
||||
}
|
||||
// Even an empty handler is enough to catch ctrl+c
|
||||
Loop::onSignal(SIGINT, static function () { die(); });
|
||||
Loop::onSignal(SIGTERM, static function () { die(); });
|
||||
self::$inited = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user