diff options
author | Akshit Grover <akshit.grover2016@gmail.com> | 2019-03-02 13:07:23 +0530 |
---|---|---|
committer | Akshit Grover <akshit.grover2016@gmail.com> | 2019-03-02 13:07:23 +0530 |
commit | 1f97a572fe35f2ff2e557b2f6ca371c67f7c2a82 (patch) | |
tree | eb0c8e52cd5a0f24c8695bfae6c8a6ec8ae2f243 /compose/service.py | |
parent | b09d8802edb498a91a73bcd63603774c9b027b47 (diff) |
Add --quiet build flag
Signed-off-by: Akshit Grover <akshit.grover2016@gmail.com>
Diffstat (limited to 'compose/service.py')
-rw-r--r-- | compose/service.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compose/service.py b/compose/service.py index 6483f4f3..b5a6b392 100644 --- a/compose/service.py +++ b/compose/service.py @@ -59,7 +59,6 @@ from .utils import parse_seconds_float from .utils import truncate_id from .utils import unique_everseen - log = logging.getLogger(__name__) @@ -1049,8 +1048,11 @@ class Service(object): return [build_spec(secret) for secret in self.secrets] def build(self, no_cache=False, pull=False, force_rm=False, memory=None, build_args_override=None, - gzip=False, rm=True): - log.info('Building %s' % self.name) + gzip=False, rm=True, silent=False): + output_stream = open(os.devnull, 'w') + if not silent: + output_stream = sys.stdout + log.info('Building %s' % self.name) build_opts = self.options.get('build', {}) @@ -1091,7 +1093,7 @@ class Service(object): ) try: - all_events = list(stream_output(build_output, sys.stdout)) + all_events = list(stream_output(build_output, output_stream)) except StreamOutputError as e: raise BuildError(self, six.text_type(e)) |