diff options
Diffstat (limited to 'lib/Model/Runner.php')
-rw-r--r-- | lib/Model/Runner.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/lib/Model/Runner.php b/lib/Model/Runner.php index 04f1d4e..3106573 100644 --- a/lib/Model/Runner.php +++ b/lib/Model/Runner.php @@ -27,6 +27,7 @@ namespace OCA\FullTextSearch\Model; +use OCA\FullTextSearch\ACommandBase; use OCA\FullTextSearch\Exceptions\RunnerAlreadyUpException; use OCA\FullTextSearch\Exceptions\TickDoesNotExistException; use OCA\FullTextSearch\Exceptions\TickIsNotAliveException; @@ -57,6 +58,9 @@ class Runner implements IRunner { /** @var int */ private $tickId; + /** @var ACommandBase */ + private $base = null; + /** @var OutputInterface */ private $outputInterface = null; @@ -131,6 +135,9 @@ class Runner implements IRunner { * @throws \Exception */ public function updateAction(string $action = '', bool $force = false): string { + + $this->base->abort(); + $n = ''; if (sizeof($this->methodOnKeyPress) > 0) { $n = fread(STDIN, 9999); @@ -145,13 +152,6 @@ class Runner implements IRunner { } $tick = time(); -// try { -// $this->hasBeenInterrupted(); -// } catch (InterruptException $e) { -// $this->stop(); -// throw $e; -// } - if ($this->oldAction !== $action || $force) { while (true) { if (!$this->isPaused()) { @@ -163,7 +163,9 @@ class Runner implements IRunner { if ($pressed === $this->keys['nextStep']) { break; } + usleep(300000); + $this->base->abort(); } $this->pauseRunning(false); @@ -408,9 +410,11 @@ class Runner implements IRunner { /** + * @param ACommandBase $base * @param OutputInterface $output */ - public function sourceIsCommandLine(OutputInterface $output) { + public function sourceIsCommandLine(ACommandBase $base, OutputInterface $output) { + $this->base = $base; $this->outputInterface = $output; } @@ -445,13 +449,6 @@ class Runner implements IRunner { } -// /** -// * @return bool -// */ -// public function isStrict() { -// return $this->strict; -// } - /** * @param string $line */ |