From patchwork Sun Nov 13 21:55:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [9,of,9] chgserver: implement a simple "runcommand" From: Jun Wu X-Patchwork-Id: 17558 Message-Id: To: Date: Sun, 13 Nov 2016 21:55:53 +0000 # HG changeset patch # User Jun Wu # Date 1479073486 0 # Sun Nov 13 21:44:46 2016 +0000 # Node ID b923b234b9032cdd87e6519dae7fbfdd292b7b40 # Parent 4660680374d24f7d46834b54de2fbbeec164e906 chgserver: implement a simple "runcommand" Although the chgserver could just use command server's runcommand. The new design could be very simple - no need to do ui copying etc. So let's write it down explicitly to use the simple version. Future patches improving the pager area also requires a different "runcommand" from the "commandserver" version. diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -438,4 +438,12 @@ class chgcmdserver(commandserver.server) os.chdir(path) + def runcommand(self): + """Reads a list of \0 terminated arguments, executes and writes the + return code to the result channel""" + args = self._readlist() + req = dispatch.request(args[:]) + ret = (dispatch.dispatch(req) or 0) & 255 # might return None + self.cresult.write(struct.pack('>i', int(ret))) + def setumask(self): """Change umask""" @@ -461,4 +469,5 @@ class chgcmdserver(commandserver.server) capabilities.update({'attachio': attachio, 'chdir': chdir, + 'runcommand': runcommand, 'setenv': setenv, 'setumask': setumask})