Skip to content

Commit

Permalink
Fixed the showing an empty error message when using the live_output
Browse files Browse the repository at this point in the history
  • Loading branch information
evandrocoan committed Oct 23, 2017
1 parent 40b91c8 commit 03f0233
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packagesmanager/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -217,6 +220,7 @@ def kill_proc():
show_error(message)
sublime.set_timeout(kill_proc, 60000)


if not live_output:
output, _ = proc.communicate(input)

Expand All @@ -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
Expand Down

0 comments on commit 03f0233

Please sign in to comment.