diff mercurial/chgserver.py @ 31125:3f8f53190d6a

chg: deduplicate error handling of ui.system() This moves 'onerr' handling from low-level util.system() to higher level, which seems better API separation.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 19 Feb 2017 01:16:45 +0900
parents fbce78c58f1e
children 82b3ec04b652
line wrap: on
line diff
--- a/mercurial/chgserver.py	Sun Feb 19 01:00:10 2017 +0900
+++ b/mercurial/chgserver.py	Sun Feb 19 01:16:45 2017 +0900
@@ -179,7 +179,7 @@
             else:
                 self._csystem = csystem
 
-        def _runsystem(self, cmd, environ, cwd, onerr, errprefix, out):
+        def _runsystem(self, cmd, environ, cwd, out):
             # fallback to the original system method if the output needs to be
             # captured (to self._buffers), or the output stream is not stdout
             # (e.g. stderr, cStringIO), because the chg client is not aware of
@@ -187,17 +187,9 @@
             if (out is not self.fout
                 or not util.safehasattr(self.fout, 'fileno')
                 or self.fout.fileno() != util.stdout.fileno()):
-                return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
-                                   errprefix=errprefix, out=out)
+                return util.system(cmd, environ=environ, cwd=cwd, out=out)
             self.flush()
-            rc = self._csystem(cmd, util.shellenviron(environ), cwd)
-            if rc and onerr:
-                errmsg = '%s %s' % (os.path.basename(cmd.split(None, 1)[0]),
-                                    util.explainexit(rc)[0])
-                if errprefix:
-                    errmsg = '%s: %s' % (errprefix, errmsg)
-                raise onerr(errmsg)
-            return rc
+            return self._csystem(cmd, util.shellenviron(environ), cwd)
 
         def _runpager(self, cmd):
             self._csystem(cmd, util.shellenviron(), type='pager',