guillermooo  committed 1fcbc83

show errors to the user

  • Participants
  • Parent commits 49e09e6

Comments (0)

Files changed (2)

File shglib/

 			elif channel == CH_DEBUG:
 				print "debug:", data
 			elif channel == CH_ERROR:
+				lines.append(data.decode(self.encoding))
 				print "error:", data
 			elif channel in (CH_INPUT, CH_LINE_INPUT):
 				print "More data requested, can't satisfy."


     print "SublimeHg:inf: Sending command '%s' as %s" % (args, args)
     text, exit_code = server.receive_data()
-    if exit_code == 0:
-        return text
+    return text, exit_code
 class KillHgServerCommand(sublime_plugin.TextCommand):
-            data = run_hg_cmd(self.command_server, self.command)
-            sublime.set_timeout(functools.partial(self.show_output, data), 0)
+            data, exit_code = run_hg_cmd(self.command_server, self.command)
+            sublime.set_timeout(functools.partial(self.show_output, data, exit_code), 0)
         except UnicodeDecodeError, e:
             print "SublimeHg: Can't handle command string characters."
             print e
-    def show_output(self, data):
+    def show_output(self, data, exit_code):
         # If we're appending to the console, do it even if there's no data.
         if data or self.append:
-            self.create_output(data)
+            self.create_output(data, exit_code)
             # Make sure we know when to restore the cmdline later.
             global recent_file_name
             sublime.status_message("SublimeHg - No output.")
-    def create_output(self, data):
+    def create_output(self, data, exit_code):
         # Output to the console or to a separate buffer.
         if not self.append:
             p = self.view.window().new_file()