1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 00:14:38 +01:00

Proper exit codes

This commit is contained in:
Daniil Gentili 2019-06-16 21:27:23 +02:00
parent 31bbe44735
commit cef7e2348c
2 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,8 @@ $p->addFromString('.git/refs/heads/master', $argv[3]);
$p->setStub('<?php
$backtrace = debug_backtrace();
if (!isset($backtrace[0]["file"]) || !in_array(basename($backtrace[0]["file"]), ["madeline.php", "phar.php", "testing.php"])) {
die("madeline.phar cannot be required manually: use the automatic loader, instead: https://docs.madelineproto.xyz/docs/INSTALLATION.html#simple".PHP_EOL);
echo("madeline.phar cannot be required manually: use the automatic loader, instead: https://docs.madelineproto.xyz/docs/INSTALLATION.html#simple".PHP_EOL);
die(1);
}
if (isset($backtrace[1]["file"])) {
@chdir(dirname($backtrace[1]["file"]));

View File

@ -37,7 +37,8 @@ if (file_exists('.env')) {
$dotenv->load();
}
if (getenv('TEST_SECRET_CHAT') == '') {
die('TEST_SECRET_CHAT is not defined in .env, please define it (copy .env.example).'.PHP_EOL);
echo('TEST_SECRET_CHAT is not defined in .env, please define it (copy .env.example).'.PHP_EOL);
die(1);
}
echo 'Loading settings...'.PHP_EOL;
$settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: [];