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