[PATCH 1 of 2] extdiff: support tools that can be run simultaneously
Yuya Nishihara
yuya at tcha.org
Sun Feb 3 07:25:41 EST 2019
On Sat, 02 Feb 2019 22:24:34 -0800, Ludovic Chabant wrote:
> # HG changeset patch
> # User Ludovic Chabant <ludovic at chabant.com>
> # Date 1549173529 28800
> # Sat Feb 02 21:58:49 2019 -0800
> # Node ID b08ea934c2d5ac097b171ca74e826e4f9dea86a9
> # Parent 3a3b053d0882a33ba7ea667052e445b193ffa4df
> extdiff: support tools that can be run simultaneously
Generally looks good. Can you add some tests?
> +def _systemdetached(cmd, environ=None, cwd=None):
> + ''' like 'procutil.system', but returns the Popen object directly
> + so we don't have to wait on it.
> + '''
> + cmd = procutil.quotecommand(cmd)
> + env = procutil.shellenviron(environ)
> + proc = subprocess.Popen(procutil.tonativestr(cmd),
> + shell=True, close_fds=procutil.closefds,
> + env=procutil.tonativeenv(env),
> + cwd=pycompat.rapply(procutil.tonativestr, cwd))
> + return proc
Nit: "detached" sounds like the process won't inherit any resources from
the parent process. Perhaps it can be called _systembackground?
> + def __init__(self, cmd, path, cmdline, isgui):
> # We can't pass non-ASCII through docstrings (and path is
> # in an unknown encoding anyway), but avoid double separators on
> # Windows
> docpath = stringutil.escapestr(path).replace(b'\\\\', b'\\')
> self.__doc__ %= {r'path': pycompat.sysstr(stringutil.uirepr(docpath))}
> self._cmdline = cmdline
> + self._cmd = cmd
> + self._isgui = isgui
Nit: cmd isn't used in this patch, but I'm okay with that.
More information about the Mercurial-devel
mailing list