From 458fd9beaa148bd924e5bcae3d68ce879f819561 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Mon, 15 Jul 2019 15:22:38 +0100
Subject: [PATCH] FEAT #9305 TIME 0:10 return error in exec command

---
 .../controllers/VersionUpdateController.php            | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/app/versionUpdate/controllers/VersionUpdateController.php b/src/app/versionUpdate/controllers/VersionUpdateController.php
index 7c6354d4451..057e0e0e8d5 100755
--- a/src/app/versionUpdate/controllers/VersionUpdateController.php
+++ b/src/app/versionUpdate/controllers/VersionUpdateController.php
@@ -89,8 +89,8 @@ class VersionUpdateController
         }
 
         $output = [];
-        $diff = exec('git diff', $output);
-        $stagedDiff = exec('git diff --staged', $output);
+        $diff = exec('git diff 2>&1', $output);
+        $stagedDiff = exec('git diff --staged 2>&1', $output);
 
         return $response->withJson([
             'lastAvailableMinorVersion' => $lastAvailableMinorVersion,
@@ -148,8 +148,8 @@ class VersionUpdateController
         $minorVersion = $availableMinorVersions[0];
 
         $output = [];
-        $diff = exec('git diff', $output);
-        $stagedDiff = exec('git diff --staged', $output);
+        $diff = exec('git diff 2>&1', $output);
+        $stagedDiff = exec('git diff --staged 2>&1', $output);
 
         if (!empty($output) || !empty($diff) || !empty($stagedDiff)) {
             return $response->withStatus(400)->withJson(['errors' => 'Some files are modified. Can not update application', 'lang' => 'canNotUpdateApplication']);
@@ -157,7 +157,7 @@ class VersionUpdateController
 
         $output = [];
         exec('git fetch');
-        exec("git checkout {$minorVersion}", $output);
+        exec("git checkout {$minorVersion} 2>&1", $output);
 
         $log = "Application updated from {$currentVersion} to {$minorVersion}\nCheckout response => " . implode(' ', $output) . "\n";
         file_put_contents('updateVersion.log', $log, FILE_APPEND);
-- 
GitLab