diff --git a/src/Executor/Master.php b/src/Executor/Master.php index 042246323..b7fa7e77f 100644 --- a/src/Executor/Master.php +++ b/src/Executor/Master.php @@ -201,9 +201,9 @@ private function runTask(Task $task, array $hosts): int } }); - $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback) { + $this->server->loop->addPeriodicTimer(0.03, function ($timer) use (&$processes, $callback, $task) { $this->gatherOutput($processes, $callback); - if ($this->output->isDecorated() && !getenv('CI')) { + if ($this->output->isDecorated() && !getenv('CI') && $task->hasSpinner()) { $this->output->write(spinner()); } if ($this->allFinished($processes)) { diff --git a/src/Task/Task.php b/src/Task/Task.php index 0dab358ee..c7bb76287 100644 --- a/src/Task/Task.php +++ b/src/Task/Task.php @@ -60,6 +60,10 @@ class Task * @var bool */ private $verbose = false; + /** + * @var bool + */ + private $spinner = true; /** * @var bool */ @@ -254,6 +258,17 @@ public function verbose(bool $verbose = true): self return $this; } + public function hasSpinner(): bool + { + return $this->spinner; + } + + public function spinner(bool $enabled = true): self + { + $this->spinner = $enabled; + return $this; + } + public function isEnabled(): bool { return $this->enabled;