Skip to content

Commit

Permalink
Add timeout to Composition.run and exec
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Valsecchi committed May 29, 2017
1 parent 4af56e1 commit b90b0f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions c2cwsgiutils/acceptance/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def restart(self, container):
'restart', '%s_%s_1' % (self.project_name, container)],
stderr=subprocess.STDOUT))

def run(self, container, *command):
def run(self, container, timeout=None, *command):
subprocess.check_call(['docker-compose', '--file', self.composition,
'--project-name', self.project_name, 'run', '--rm', container] + list(command),
env=Composition._get_env(), stderr=subprocess.STDOUT)
env=Composition._get_env(), stderr=subprocess.STDOUT, timeout=timeout)

def exec(self, container, *command):
def exec(self, container, timeout=None, *command):
subprocess.check_call(['docker-compose', '--file', self.composition,
'--project-name', self.project_name, 'exec', '-T', container] + list(command),
env=Composition._get_env(), stderr=subprocess.STDOUT)
env=Composition._get_env(), stderr=subprocess.STDOUT, timeout=timeout)

@staticmethod
def _get_env():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages


VERSION = '0.11.1'
VERSION = '0.11.2'
HERE = os.path.abspath(os.path.dirname(__file__))
INSTALL_REQUIRES = open(os.path.join(HERE, 'rel_requirements.txt')).read().splitlines()

Expand Down

0 comments on commit b90b0f2

Please sign in to comment.