Fix exit codes on PHP 5

This commit is contained in:
Niklas Keller
2016-03-23 22:05:24 +01:00
parent 8549ff9e46
commit 1c4a2387e9
4 changed files with 10 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
namespace Kelunik\AcmeClient\Commands;
use Amp\CoroutineResult;
use Kelunik\AcmeClient\Stores\CertificateStore;
use Kelunik\Certificate\Certificate;
use League\CLImate\Argument\Manager;
@@ -35,12 +36,13 @@ class Check implements Command {
$this->climate->info("Certificate is valid until " . date("d.m.Y", $cert->getValidTo()));
if ($cert->getValidTo() > time() + $args->get("ttl") * 24 * 60 * 60) {
return 0;
yield new CoroutineResult(0);
return;
}
$this->climate->comment("Certificate is going to expire within the specified " . $args->get("ttl") . " days.");
return 1;
yield new CoroutineResult(1);
}
public static function getDefinition() {

View File

@@ -2,6 +2,7 @@
namespace Kelunik\AcmeClient\Commands;
use Amp\CoroutineResult;
use Amp\Dns\Record;
use Exception;
use Kelunik\Acme\AcmeClient;
@@ -113,7 +114,7 @@ class Issue implements Command {
$this->climate->info("Successfully issued certificate, see {$path}/" . reset($domains));
return 0;
yield new CoroutineResult(0);
}
private function solveChallenge(AcmeService $acme, KeyPair $keyPair, $domain, $path) {

View File

@@ -2,6 +2,7 @@
namespace Kelunik\AcmeClient\Commands;
use Amp\CoroutineResult;
use Amp\File\FilesystemException;
use Kelunik\Acme\AcmeClient;
use Kelunik\Acme\AcmeService;
@@ -52,7 +53,7 @@ class Revoke implements Command {
yield (new CertificateStore(\Kelunik\AcmeClient\normalizePath($args->get("storage")). "/certs/" . $keyFile))->delete($args->get("name"));
return 0;
yield new CoroutineResult(0);
}
public static function getDefinition() {

View File

@@ -2,6 +2,7 @@
namespace Kelunik\AcmeClient\Commands;
use Amp\CoroutineResult;
use Amp\Dns\Record;
use Amp\Dns\ResolutionException;
use InvalidArgumentException;
@@ -58,7 +59,7 @@ class Setup implements Command {
$registration = (yield $acme->register($email));
$this->climate->whisper("Registration successful with the following contact information: " . implode(", ", $registration->getContact()));
return 0;
yield new CoroutineResult(0);
}
private function checkEmail($email) {