fix: Buffer output

This commit is contained in:
SychO9 2021-09-29 14:04:53 +01:00
parent 1b65c6862e
commit 79b5629125
6 changed files with 24 additions and 12 deletions

View File

@ -57,13 +57,14 @@ class CheckForUpdatesHandler
]);
$exitCode = $this->composer->run($input, $output);
$output = $output->fetch();
$this->logger->log($output->fetch(), $exitCode);
$this->logger->log($output, $exitCode);
if ($exitCode !== 0) {
throw new ComposerCommandFailedException('', $output->fetch());
throw new ComposerCommandFailedException('', $output);
}
return $this->lastUpdateCheck->save(json_decode($output->fetch(), true));
return $this->lastUpdateCheck->save(json_decode($output, true));
}
}

View File

@ -62,11 +62,12 @@ class GlobalUpdateHandler
]);
$exitCode = $this->composer->run($input, $output);
$output = $output->fetch();
$this->logger->log($output->fetch(), $exitCode);
$this->logger->log($output, $exitCode);
if ($exitCode !== 0) {
throw new ComposerUpdateFailedException('*', $output->fetch());
throw new ComposerUpdateFailedException('*', $output);
}
$this->commandDispatcher->dispatch(

View File

@ -64,11 +64,12 @@ class MinorFlarumUpdateHandler
]);
$exitCode = $this->composer->run($input, $output);
$output = $output->fetch();
$this->logger->log($output->fetch(), $exitCode);
$this->logger->log($output, $exitCode);
if ($exitCode !== 0) {
throw new ComposerUpdateFailedException('flarum/*', $output->fetch());
throw new ComposerUpdateFailedException('flarum/*', $output);
}
$this->lastUpdateCheck->forget('flarum/*', true);

View File

@ -9,6 +9,8 @@ namespace SychO\PackageManager\Command;
use Composer\Console\Application;
use Flarum\Extension\ExtensionManager;
use Illuminate\Contracts\Events\Dispatcher;
use SychO\PackageManager\Exception\ComposerCommandFailedException;
use SychO\PackageManager\Exception\ComposerUpdateFailedException;
use SychO\PackageManager\Exception\ExtensionNotInstalledException;
use SychO\PackageManager\Extension\Event\Removed;
use SychO\PackageManager\OutputLogger;
@ -66,8 +68,13 @@ class RemoveExtensionHandler
]);
$exitCode = $this->composer->run($input, $output);
$output = $output->fetch();
$this->logger->log($output->fetch(), $exitCode);
$this->logger->log($output, $exitCode);
if ($exitCode !== 0) {
throw new ComposerCommandFailedException($extension->name, $output);
}
$this->events->dispatch(
new Removed($extension)

View File

@ -78,11 +78,12 @@ class RequireExtensionHandler
]);
$exitCode = $this->composer->run($input, $output);
$output = $output->fetch();
$this->logger->log($output->fetch(), $exitCode);
$this->logger->log($output, $exitCode);
if ($exitCode !== 0) {
throw new ComposerRequireFailedException($command->package, $output->fetch());
throw new ComposerRequireFailedException($command->package, $output);
}
$this->events->dispatch(

View File

@ -90,11 +90,12 @@ class UpdateExtensionHandler
]);
$exitCode = $this->composer->run($input, $output);
$output = $output->fetch();
$this->logger->log($output->fetch(), $exitCode);
$this->logger->log($output, $exitCode);
if ($exitCode !== 0) {
throw new ComposerUpdateFailedException($extension->name, $output->fetch());
throw new ComposerUpdateFailedException($extension->name, $output);
}
$this->lastUpdateCheck->forget($extension->name);