diff --git a/src/Robo/Commands/Deploy/DeployCommand.php b/src/Robo/Commands/Deploy/DeployCommand.php index 8e9a2add07..723db813e6 100644 --- a/src/Robo/Commands/Deploy/DeployCommand.php +++ b/src/Robo/Commands/Deploy/DeployCommand.php @@ -401,11 +401,19 @@ protected function composerInstall() { * Creates deployment_identifier file. */ protected function createDeployId($id) { - $this->taskExecStack()->exec("echo '$id' > deployment_identifier") - ->dir($this->deployDir) - ->stopOnFail() + $deployment_identifier_file = $this->getConfigValue('repo.root') . '/deployment_identifier'; + $this->say("Generating deployment identifier..."); + $result = $this->taskWriteToFile($deployment_identifier_file) + ->line($id) ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) ->run(); + + if (!$result->wasSuccessful()) { + $filepath = $this->getInspector()->getFs()->makePathRelative($deployment_identifier_file, $this->getConfigValue('repo.root')); + throw new BltException("Unable to write deployment identifier to $filepath."); + } + + return $result->getExitCode(); } /** diff --git a/src/Robo/Commands/Setup/BuildCommand.php b/src/Robo/Commands/Setup/BuildCommand.php index ac3b6fde62..371028989b 100644 --- a/src/Robo/Commands/Setup/BuildCommand.php +++ b/src/Robo/Commands/Setup/BuildCommand.php @@ -44,11 +44,19 @@ public function drupalInstall() { * Creates deployment_identifier file. */ protected function createDeployId($id) { - $this->taskExecStack()->exec("echo '$id' > deployment_identifier") - ->dir($this->getConfigValue('repo.root')) - ->stopOnFail() + $deployment_identifier_file = $this->getConfigValue('repo.root') . '/deployment_identifier'; + $this->say("Generating deployment identifier..."); + $result = $this->taskWriteToFile($deployment_identifier_file) + ->line($id) ->setVerbosityThreshold(VerbosityThresholdInterface::VERBOSITY_VERBOSE) ->run(); + + if (!$result->wasSuccessful()) { + $filepath = $this->getInspector()->getFs()->makePathRelative($deployment_identifier_file, $this->getConfigValue('repo.root')); + throw new BltException("Unable to write deployment identifier to $filepath."); + } + + return $result->getExitCode(); } /**