From f380fb4407dc3f35d59ed1fece7a4fa3893b7294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C4=83nu=C5=A3=20Antoche?= Date: Sat, 20 Jan 2018 23:00:19 -0800 Subject: [PATCH] Saving process object for later use. --- src/Alchemy/BinaryDriver/AbstractBinary.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Alchemy/BinaryDriver/AbstractBinary.php b/src/Alchemy/BinaryDriver/AbstractBinary.php index ee8f8df..fe9fb52 100644 --- a/src/Alchemy/BinaryDriver/AbstractBinary.php +++ b/src/Alchemy/BinaryDriver/AbstractBinary.php @@ -36,6 +36,9 @@ abstract class AbstractBinary extends EventEmitter implements BinaryInterface /** @var Listeners */ private $listenersManager; + /** @var Process */ + private $lastProcess; + public function __construct(ProcessBuilderFactoryInterface $factory, LoggerInterface $logger, ConfigurationInterface $configuration) { $this->factory = $factory; @@ -134,7 +137,17 @@ public function command($command, $bypassErrors = false, $listeners = null) $command = array($command); } - return $this->run($this->factory->create($command), $bypassErrors, $listeners); + // what if we still need to access the process object? + $this->lastProcess = $this->factory->create($command); + return $this->run($this->lastProcess, $bypassErrors, $listeners); + } + + /** + * @return Process Last ran process + */ + public function getLastProcess() + { + return $this->lastProcess; } /**