Mercurial > libervia-backend
annotate sat/tools/common/async_process.py @ 3033:0d55a52056f7
tools (async_process): log command as str
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 16 Aug 2019 17:06:51 +0200 |
parents | ab2696e34d29 |
children | fee60f17ebac |
rev | line source |
---|---|
3028 | 1 #!/usr/bin/env python3 |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # SAT: a jabber client |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 """tools to launch process in a async way (using Twisted)""" |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 import os.path |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 from twisted.internet import defer, reactor, protocol |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 from twisted.python.failure import Failure |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 from sat.core.i18n import _ |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from sat.core import exceptions |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from sat.core.log import getLogger |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 log = getLogger(__name__) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 class CommandProtocol(protocol.ProcessProtocol): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 """handle an external command""" |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 # name of the command (unicode) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 name = None |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 # full path to the command (bytes) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 command = None |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 # True to activate logging of command outputs (bool) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 log = False |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 def __init__(self, deferred, stdin=None): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 """ |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 @param deferred(defer.Deferred): will be called when command is completed |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 @param stdin(str, None): if not None, will be push to standard input |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 """ |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 self._stdin = stdin |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 self._deferred = deferred |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 self.data = [] |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 self.err_data = [] |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 @property |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 def command_name(self): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 """returns command name or empty string if it can't be guessed""" |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 if self.name is not None: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 return self.name |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 elif self.command is not None: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 return os.path.splitext(os.path.basename(self.command))[0].decode('utf-8', |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 'ignore') |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 else: |
3028 | 59 return '' |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 def connectionMade(self): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 if self._stdin is not None: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 self.transport.write(self._stdin) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 self.transport.closeStdin() |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 def outReceived(self, data): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 if self.log: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 log.info(data.decode('utf-8', 'replace')) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 self.data.append(data) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 def errReceived(self, data): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 if self.log: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 log.warning(data.decode('utf-8', 'replace')) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 self.err_data.append(data) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 def processEnded(self, reason): |
3028 | 77 data = b''.join(self.data) |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 if (reason.value.exitCode == 0): |
3033
0d55a52056f7
tools (async_process): log command as str
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
79 log.debug(_('{name!r} command succeed').format( |
0d55a52056f7
tools (async_process): log command as str
Goffi <goffi@goffi.org>
parents:
3028
diff
changeset
|
80 name=self.command_name.decode('utf-8', 'ignore'))) |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 # we don't use "replace" on purpose, we want an exception if decoding |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 # is not working properly |
3028 | 83 self._deferred.callback(data) |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 else: |
3028 | 85 err_data = b''.join(self.err_data) |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 |
3028 | 87 msg = (_("Can't complete {name} command (error code: {code}):\n" |
88 "stderr:\n{stderr}\n{stdout}\n") | |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 .format(name = self.command_name, |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 code = reason.value.exitCode, |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 stderr= err_data.encode('utf-8', 'replace'), |
3028 | 92 stdout = "stdout: " + data.decode('utf-8', 'replace') |
93 if data else '', | |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 )) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 self._deferred.errback(Failure(exceptions.CommandException( |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 msg, data, err_data))) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 @classmethod |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 def run(cls, *args, **kwargs): |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 """Create a new CommandProtocol and execute the given command. |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 @param *args(unicode): command arguments |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 if cls.command is specified, it will be the path to the command to execture |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 otherwise, first argument must be the path |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 @param **kwargs: can be: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 - stdin(unicode, None): data to push to standard input |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 - verbose(bool): if True stdout and stderr will be logged |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 other keyword arguments will be used in reactor.spawnProcess |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 @return ((D)): stdout in case of success |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 @raise RuntimeError: command returned a non zero status |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 stdin and stdout will be given as arguments |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 """ |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 stdin = kwargs.pop('stdin', None) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 if stdin is not None: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 stdin = stdin.encode('utf-8') |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 verbose = kwargs.pop('verbose', False) |
3028 | 118 if 'path' in kwargs: |
119 kwargs['path'] = kwargs['path'].encode('utf-8') | |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 args = [a.encode('utf-8') for a in args] |
3028 | 121 kwargs = {k:v.encode('utf-8') for k,v in list(kwargs.items())} |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 d = defer.Deferred() |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 prot = cls(d, stdin=stdin) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 if verbose: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 prot.log = True |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 if cls.command is None: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 if not args: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 raise ValueError( |
3028 | 129 "You must either specify cls.command or use a full path to command " |
130 "to execute as first argument") | |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 command = args.pop(0) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 if prot.name is None: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 name = os.path.splitext(os.path.basename(command))[0] |
3028 | 134 prot.name = name |
2793
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 else: |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 command = cls.command |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 cmd_args = [os.path.basename(command)] + args |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 reactor.spawnProcess(prot, |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 command, |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 cmd_args, |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 **kwargs) |
181735d1b062
plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 return d |