From 03f023361d39d78fe55af5ddb3743d17221e8f58 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Sun, 22 Oct 2017 22:31:00 -0200 Subject: [PATCH] Fixed the showing an empty error message when using the live_output --- packagesmanager/cmd.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packagesmanager/cmd.py b/packagesmanager/cmd.py index f364f140..335f8f08 100644 --- a/packagesmanager/cmd.py +++ b/packagesmanager/cmd.py @@ -111,8 +111,10 @@ def execute(self, args, cwd, input=None, encoding='utf-8', meaningful_output=Fal """ # live_output does not works for python version < 3 - output = "The live_output is being performed." - live_output = live_output and not sys.version_info[0] < 3 + output = "" + + output_lines = [] + live_output = live_output and not sys.version_info[0] < 3 orig_cwd = cwd startupinfo = None @@ -158,6 +160,7 @@ def execute(self, args, cwd, input=None, encoding='utf-8', meaningful_output=Fal line = line.replace('\r\n', '\n').rstrip(' \n\r') # process line here + output_lines.append(line) print(line) else: proc = subprocess.Popen( @@ -217,6 +220,7 @@ def kill_proc(): show_error(message) sublime.set_timeout(kill_proc, 60000) + if not live_output: output, _ = proc.communicate(input) @@ -228,6 +232,11 @@ def kill_proc(): if proc.returncode not in self.ok_returncodes: if not ignore_errors or re.search(ignore_errors, output) is None: + + # Create a message to display on the error box while using the `live_output` + if len( output ) < 2: + output = "".join( output_lines ) + message = text.format( u''' Error executing: %s