From aa12c130568cade877873f3ff421c5a2e22f7f27 Mon Sep 17 00:00:00 2001 From: jebsolutions Date: Sun, 20 Nov 2016 15:55:12 -0500 Subject: [PATCH] include stderr in git pull results and check for error (#2104) Old result (seems correct but actually failed) Updating d190f6a..d958bea Corrected result (includes failure message): Updating d190f6a..d958bea error: Your local changes to the following files would be overwritten by merge: app/fax/fax_log_view.php Please, commit your changes or stash them before you can merge. --- core/upgrade/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/upgrade/index.php b/core/upgrade/index.php index 18f5e88760..6952786489 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -56,7 +56,7 @@ // run source update if ($do["source"] && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) { chdir($_SERVER["PROJECT_ROOT"]); - exec("git pull", $response_source_update); + exec("git pull 2>&1", $response_source_update); $update_failed = true; if (sizeof($response_source_update) > 0) { $_SESSION["response_source_update"] = $response_source_update; @@ -64,6 +64,11 @@ if (substr_count($response_line, "Updating ") > 0 || substr_count($response_line, "Already up-to-date.") > 0) { $update_failed = false; } + + if (substr_count($response_line, "error") > 0) { + $update_failed = true; + break; + } } } if ($update_failed) {