diff --git a/lib/core/subprocessng.py b/lib/core/subprocessng.py index 097413b64..58491e790 100644 --- a/lib/core/subprocessng.py +++ b/lib/core/subprocessng.py @@ -71,7 +71,7 @@ def setNonBlocking(fd): flags = flags | os.O_NONBLOCK fcntl.fcntl(fd, FCNTL.F_SETFL, flags) -def pollProcess(process): +def pollProcess(process, suppress_errors=False): while True: dataToStdout(".") time.sleep(1) @@ -79,11 +79,12 @@ def pollProcess(process): returncode = process.poll() if returncode is not None: - if returncode == 0: - dataToStdout(" done\n") - elif returncode < 0: - dataToStdout(" process terminated by signal %d\n" % returncode) - elif returncode > 0: - dataToStdout(" quit unexpectedly with return code %d\n" % returncode) + if not suppress_errors: + if returncode == 0: + dataToStdout(" done\n") + elif returncode < 0: + dataToStdout(" process terminated by signal %d\n" % returncode) + elif returncode > 0: + dataToStdout(" quit unexpectedly with return code %d\n" % returncode) break diff --git a/lib/core/update.py b/lib/core/update.py index 0a40b9995..732d3b491 100644 --- a/lib/core/update.py +++ b/lib/core/update.py @@ -35,15 +35,21 @@ def update(): logger.debug(debugMsg) dataToStdout("\r[%s] [INFO] update in progress " % time.strftime("%X")) - process = execute("git pull %s" % rootDir, shell=True, stdout=PIPE, stderr=PIPE) - pollProcess(process) - stdout, _ = process.communicate() + process = execute("gita pull %s" % rootDir, shell=True, stdout=PIPE, stderr=PIPE) + pollProcess(process, True) + stdout, stderr = process.communicate() if not process.returncode: logger.info("%s the latest revision '%s'" % ("already at" if "Already" in stdout else "updated to", REVISION)) + else: + logger.error("update could not be completed (%s)" % repr(stderr)) + + if IS_WIN: + infoMsg = "for Windows platform it's recommended " + infoMsg += "to use a GitHub for Windows client for updating " + infoMsg += "purposes (http://windows.github.com/)" + else: + infoMsg = "for Linux platform it's recommended " + infoMsg += "to use a standard 'git' package (e.g.: 'sudo apt-get install git')" - if IS_WIN: - infoMsg = "for Windows platform it's recommended " - infoMsg += "to use a GitHub for Windows client for updating " - infoMsg += "purposes (http://windows.github.com/)" logger.info(infoMsg)