annotate sat/tools/common/async_process.py @ 4036:c4464d7ae97b

dpc (cli/info): update "disco" documentation to include new "external services": fix 418
author Goffi <goffi@goffi.org>
date Fri, 07 Apr 2023 15:18:39 +0200
parents 799d4f6fa7ca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
1 #!/usr/bin/env python3
3137
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
2
2793
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
3479
be6d91572633 date update
Goffi <goffi@goffi.org>
parents: 3368
diff changeset
5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
2793
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
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
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
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
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):
3568
04283582966f core, frontends: fix invalid translatable strings.
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
79 log.debug(f'{self.command_name!r} command succeed')
2793
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
80 # 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
81 # is not working properly
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
82 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
83 else:
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
84 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
85
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
86 msg = (_("Can't complete {name} command (error code: {code}):\n"
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
87 "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
88 .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
89 code = reason.value.exitCode,
3161
be5fffe34987 tools (common/async_process): fixed stderr handling + added global "run"
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
90 stderr= err_data.decode(errors='replace'),
be5fffe34987 tools (common/async_process): fixed stderr handling + added global "run"
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
91 stdout = "stdout: " + data.decode(errors='replace')
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
92 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
93 ))
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
94 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
95 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
96
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
97 @classmethod
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
98 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
99 """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
100
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
101 @param *args(unicode): command arguments
3368
e86b71b1aa31 core: minor typos, docstring/comments update
Goffi <goffi@goffi.org>
parents: 3161
diff changeset
102 if cls.command is specified, it will be the path to the command to execute
2793
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
103 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
104 @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
105 - 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
106 - 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
107 other keyword arguments will be used in reactor.spawnProcess
3040
fee60f17ebac jp: jp asyncio port:
Goffi <goffi@goffi.org>
parents: 3033
diff changeset
108 @return ((D)bytes): stdout in case of success
2793
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
109 @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
110 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
111
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 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
114 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
115 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
116 verbose = kwargs.pop('verbose', False)
3660
e584ce33ef1d tools (common/async_process): remove useless encoding + use full path for command:
Goffi <goffi@goffi.org>
parents: 3568
diff changeset
117 args = list(args)
2793
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
118 d = defer.Deferred()
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
119 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
120 if verbose:
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
121 prot.log = True
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
122 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
123 if not args:
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
124 raise ValueError(
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
125 "You must either specify cls.command or use a full path to command "
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
126 "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
127 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
128 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
129 name = os.path.splitext(os.path.basename(command))[0]
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2793
diff changeset
130 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
131 else:
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
132 command = cls.command
3660
e584ce33ef1d tools (common/async_process): remove useless encoding + use full path for command:
Goffi <goffi@goffi.org>
parents: 3568
diff changeset
133 cmd_args = [command] + args
3712
799d4f6fa7ca tools (common/async_process): use parent environment by default
Goffi <goffi@goffi.org>
parents: 3660
diff changeset
134 if "env" not in kwargs:
799d4f6fa7ca tools (common/async_process): use parent environment by default
Goffi <goffi@goffi.org>
parents: 3660
diff changeset
135 # we pass parent environment by default
799d4f6fa7ca tools (common/async_process): use parent environment by default
Goffi <goffi@goffi.org>
parents: 3660
diff changeset
136 kwargs["env"] = None
2793
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
137 reactor.spawnProcess(prot,
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
138 command,
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
139 cmd_args,
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
140 **kwargs)
181735d1b062 plugin mr mercurial, tools(common/utils): moved command protocol to a new module
Goffi <goffi@goffi.org>
parents:
diff changeset
141 return d
3161
be5fffe34987 tools (common/async_process): fixed stderr handling + added global "run"
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
142
be5fffe34987 tools (common/async_process): fixed stderr handling + added global "run"
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
143
be5fffe34987 tools (common/async_process): fixed stderr handling + added global "run"
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
144 run = CommandProtocol.run