Show More
@@ -26,7 +26,7 b' import os' | |||
|
26 | 26 | import datetime |
|
27 | 27 | import logging |
|
28 | 28 | import Queue |
|
29 |
import subprocess |
|
|
29 | import subprocess | |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | from dateutil.parser import parse |
@@ -359,7 +359,7 b' class AsyncSubscriber(Subscriber):' | |||
|
359 | 359 | |
|
360 | 360 | class AsyncSubprocessSubscriber(AsyncSubscriber): |
|
361 | 361 | """ |
|
362 |
Subscriber that uses the subprocess |
|
|
362 | Subscriber that uses the subprocess module to execute a command if an | |
|
363 | 363 | event is received. Events are handled asynchronously:: |
|
364 | 364 | |
|
365 | 365 | subscriber = AsyncSubprocessSubscriber('ls -la', timeout=10) |
@@ -380,16 +380,16 b' class AsyncSubprocessSubscriber(AsyncSub' | |||
|
380 | 380 | log.debug('Executing command %s.', cmd) |
|
381 | 381 | |
|
382 | 382 | try: |
|
383 |
output = subprocess |
|
|
384 |
cmd, timeout=timeout, stderr=subprocess |
|
|
383 | output = subprocess.check_output( | |
|
384 | cmd, timeout=timeout, stderr=subprocess.STDOUT) | |
|
385 | 385 | log.debug('Command finished %s', cmd) |
|
386 | 386 | if output: |
|
387 | 387 | log.debug('Command output: %s', output) |
|
388 |
except subprocess |
|
|
388 | except subprocess.TimeoutExpired as e: | |
|
389 | 389 | log.exception('Timeout while executing command.') |
|
390 | 390 | if e.output: |
|
391 | 391 | log.error('Command output: %s', e.output) |
|
392 |
except subprocess |
|
|
392 | except subprocess.CalledProcessError as e: | |
|
393 | 393 | log.exception('Error while executing command.') |
|
394 | 394 | if e.output: |
|
395 | 395 | log.error('Command output: %s', e.output) |
@@ -18,7 +18,7 b'' | |||
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 |
from subprocess |
|
|
21 | from subprocess import Popen, PIPE | |
|
22 | 22 | import os |
|
23 | 23 | import shutil |
|
24 | 24 | import sys |
@@ -24,7 +24,7 b' Checking the chunked data transfer via H' | |||
|
24 | 24 | |
|
25 | 25 | import os |
|
26 | 26 | import time |
|
27 |
import subprocess |
|
|
27 | import subprocess | |
|
28 | 28 | |
|
29 | 29 | import pytest |
|
30 | 30 | import requests |
@@ -53,7 +53,7 b' def echo_app_chunking(request, available' | |||
|
53 | 53 | 'rhodecode.tests.lib.middleware.utils.test_scm_app_http_chunking' |
|
54 | 54 | ':create_echo_app') |
|
55 | 55 | command = command.format(port=port) |
|
56 |
proc = subprocess |
|
|
56 | proc = subprocess.Popen(command.split(' '), bufsize=0) | |
|
57 | 57 | echo_app_url = 'http://localhost:' + str(port) |
|
58 | 58 | |
|
59 | 59 | @request.addfinalizer |
@@ -78,7 +78,7 b' def scm_app(request, available_port_fact' | |||
|
78 | 78 | command = command.format(port=port) |
|
79 | 79 | env = os.environ.copy() |
|
80 | 80 | env["RC_ECHO_URL"] = echo_app_chunking |
|
81 |
proc = subprocess |
|
|
81 | proc = subprocess.Popen(command.split(' '), bufsize=0, env=env) | |
|
82 | 82 | scm_app_url = 'http://localhost:' + str(port) |
|
83 | 83 | wait_for_url(scm_app_url) |
|
84 | 84 |
@@ -32,7 +32,7 b' import itertools' | |||
|
32 | 32 | import os |
|
33 | 33 | import pprint |
|
34 | 34 | import shutil |
|
35 |
import subprocess |
|
|
35 | import subprocess | |
|
36 | 36 | import sys |
|
37 | 37 | import time |
|
38 | 38 | |
@@ -77,12 +77,12 b' def execute(*popenargs, **kwargs):' | |||
|
77 | 77 | input = kwargs.pop('stdin', None) |
|
78 | 78 | stdin = None |
|
79 | 79 | if input: |
|
80 |
stdin = subprocess |
|
|
80 | stdin = subprocess.PIPE | |
|
81 | 81 | #if 'stderr' not in kwargs: |
|
82 |
# kwargs['stderr'] = subprocess |
|
|
82 | # kwargs['stderr'] = subprocess.PIPE | |
|
83 | 83 | if 'stdout' in kwargs: |
|
84 | 84 | raise ValueError('stdout argument not allowed, it will be overridden.') |
|
85 |
process = subprocess |
|
|
85 | process = subprocess.Popen(stdin=stdin, stdout=subprocess.PIPE, | |
|
86 | 86 | *popenargs, **kwargs) |
|
87 | 87 | output, error = process.communicate(input=input) |
|
88 | 88 | retcode = process.poll() |
@@ -91,7 +91,7 b' def execute(*popenargs, **kwargs):' | |||
|
91 | 91 | if cmd is None: |
|
92 | 92 | cmd = popenargs[0] |
|
93 | 93 | print('{} {} {} '.format(cmd, output, error)) |
|
94 |
raise subprocess |
|
|
94 | raise subprocess.CalledProcessError(retcode, cmd, output=output) | |
|
95 | 95 | return output |
|
96 | 96 | |
|
97 | 97 |
@@ -31,7 +31,7 b' To stop the script by press Ctrl-C' | |||
|
31 | 31 | import datetime |
|
32 | 32 | import os |
|
33 | 33 | import psutil |
|
34 |
import subprocess |
|
|
34 | import subprocess | |
|
35 | 35 | import sys |
|
36 | 36 | import time |
|
37 | 37 | import traceback |
@@ -66,7 +66,7 b' def dump_system():' | |||
|
66 | 66 | |
|
67 | 67 | |
|
68 | 68 | def count_dulwich_fds(proc): |
|
69 |
p = subprocess |
|
|
69 | p = subprocess.Popen(["lsof", "-p", proc.pid], stdout=subprocess.PIPE) | |
|
70 | 70 | out, err = p.communicate() |
|
71 | 71 | |
|
72 | 72 | count = 0 |
@@ -117,7 +117,7 b' print("VCS - Ok")' | |||
|
117 | 117 | |
|
118 | 118 | print("\nStarting RhodeCode...") |
|
119 | 119 | rc = psutil.Popen("RC_VCSSERVER_TEST_DISABLE=1 paster serve test.ini", |
|
120 |
shell=True, stdin=subprocess |
|
|
120 | shell=True, stdin=subprocess.PIPE) | |
|
121 | 121 | time.sleep(1) |
|
122 | 122 | if not rc.is_running(): |
|
123 | 123 | print("RC - Failed to start") |
@@ -40,7 +40,7 b' import functools' | |||
|
40 | 40 | import logging |
|
41 | 41 | import os |
|
42 | 42 | import shutil |
|
43 |
import subprocess |
|
|
43 | import subprocess | |
|
44 | 44 | import tempfile |
|
45 | 45 | import time |
|
46 | 46 | from itertools import chain |
@@ -145,8 +145,8 b' class Repository(object):' | |||
|
145 | 145 | |
|
146 | 146 | def _run(self, *args): |
|
147 | 147 | command = [self.BASE_COMMAND] + list(args) |
|
148 |
process = subprocess |
|
|
149 |
command, stdout=subprocess |
|
|
148 | process = subprocess.Popen( | |
|
149 | command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
|
150 | 150 | return process.communicate() |
|
151 | 151 | |
|
152 | 152 | def _create_file(self, name, size): |
@@ -26,7 +26,7 b' import re' | |||
|
26 | 26 | import pprint |
|
27 | 27 | import shutil |
|
28 | 28 | import socket |
|
29 |
import subprocess |
|
|
29 | import subprocess | |
|
30 | 30 | import time |
|
31 | 31 | import uuid |
|
32 | 32 | import dateutil.tz |
@@ -928,7 +928,7 b' class RepoServer(object):' | |||
|
928 | 928 | if vcsrepo.alias != 'svn': |
|
929 | 929 | raise TypeError("Backend %s not supported" % vcsrepo.alias) |
|
930 | 930 | |
|
931 |
proc = subprocess |
|
|
931 | proc = subprocess.Popen( | |
|
932 | 932 | ['svnserve', '-d', '--foreground', '--listen-host', 'localhost', |
|
933 | 933 | '--root', vcsrepo.path]) |
|
934 | 934 | self._cleanup_servers.append(proc) |
@@ -30,7 +30,7 b' from os.path import join as jn' | |||
|
30 | 30 | from os.path import dirname as dn |
|
31 | 31 | |
|
32 | 32 | from tempfile import _RandomNameSequence |
|
33 |
from subprocess |
|
|
33 | from subprocess import Popen, PIPE | |
|
34 | 34 | |
|
35 | 35 | from rhodecode.lib.utils2 import engine_from_config |
|
36 | 36 | from rhodecode.lib.auth import get_crypt_password |
@@ -23,7 +23,7 b' import os' | |||
|
23 | 23 | import time |
|
24 | 24 | import tempfile |
|
25 | 25 | import pytest |
|
26 |
import subprocess |
|
|
26 | import subprocess | |
|
27 | 27 | import configobj |
|
28 | 28 | import logging |
|
29 | 29 | from urllib.request import urlopen |
@@ -152,7 +152,7 b' class RcVCSServer(ServerBase):' | |||
|
152 | 152 | log.info('rhodecode-vcsserver command: {}'.format(self.command)) |
|
153 | 153 | log.info('rhodecode-vcsserver logfile: {}'.format(self.log_file)) |
|
154 | 154 | |
|
155 |
self.process = subprocess |
|
|
155 | self.process = subprocess.Popen( | |
|
156 | 156 | self._args, bufsize=0, env=env, |
|
157 | 157 | stdout=self.server_out, stderr=self.server_out) |
|
158 | 158 | |
@@ -184,7 +184,7 b' class RcWebServer(ServerBase):' | |||
|
184 | 184 | log.info('rhodecode-web command: {}'.format(self.command)) |
|
185 | 185 | log.info('rhodecode-web logfile: {}'.format(self.log_file)) |
|
186 | 186 | |
|
187 |
self.process = subprocess |
|
|
187 | self.process = subprocess.Popen( | |
|
188 | 188 | self._args, bufsize=0, env=env, |
|
189 | 189 | stdout=self.server_out, stderr=self.server_out) |
|
190 | 190 |
@@ -22,7 +22,7 b' import threading' | |||
|
22 | 22 | import time |
|
23 | 23 | import logging |
|
24 | 24 | import os.path |
|
25 |
import subprocess |
|
|
25 | import subprocess | |
|
26 | 26 | import tempfile |
|
27 | 27 | import urllib.request, urllib.error, urllib.parse |
|
28 | 28 | from lxml.html import fromstring, tostring |
@@ -223,10 +223,10 b' def _load_svn_dump_into_repo(dump_name, ' | |||
|
223 | 223 | integrated with the main repository once they stabilize more. |
|
224 | 224 | """ |
|
225 | 225 | dump = rc_testdata.load_svn_dump(dump_name) |
|
226 |
load_dump = subprocess |
|
|
226 | load_dump = subprocess.Popen( | |
|
227 | 227 | ['svnadmin', 'load', repo_path], |
|
228 |
stdin=subprocess |
|
|
229 |
stderr=subprocess |
|
|
228 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, | |
|
229 | stderr=subprocess.PIPE) | |
|
230 | 230 | out, err = load_dump.communicate(dump) |
|
231 | 231 | if load_dump.returncode != 0: |
|
232 | 232 | log.error("Output of load_dump command: %s", out) |
@@ -20,7 +20,7 b'' | |||
|
20 | 20 | |
|
21 | 21 | import os |
|
22 | 22 | import datetime |
|
23 |
import subprocess |
|
|
23 | import subprocess | |
|
24 | 24 | |
|
25 | 25 | import pytest |
|
26 | 26 | |
@@ -86,8 +86,8 b' class TestGetScm(object):' | |||
|
86 | 86 | def test_get_two_scms_for_path(self, tmpdir): |
|
87 | 87 | multialias_repo_path = str(tmpdir) |
|
88 | 88 | |
|
89 |
subprocess |
|
|
90 |
subprocess |
|
|
89 | subprocess.check_call(['hg', 'init', multialias_repo_path]) | |
|
90 | subprocess.check_call(['git', 'init', multialias_repo_path]) | |
|
91 | 91 | |
|
92 | 92 | with pytest.raises(VCSError): |
|
93 | 93 | get_scm(multialias_repo_path) |
General Comments 0
You need to be logged in to leave comments.
Login now