Skip to content

Commit 0dd5483

Browse files
peteristhegreatph-conn
authored andcommitted
Remove excess whitespace
1 parent e7752b2 commit 0dd5483

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docker/models/images.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ def build(self, stream=False, timestamp=False, **kwargs):
246246
custom_context (bool): Optional if using ``fileobj``
247247
encoding (str): The encoding for a stream. Set to ``gzip`` for
248248
compressing
249-
stream (bool): Print the build output to stdout and stderr while
249+
stream (bool): Print the build output to stdout and stderr while
250250
the build runs
251-
timestamp (bool): Prefix build output stream with a timestamp
251+
timestamp (bool): Prefix build output stream with a timestamp
252252
"%Y-%m-%d %H:%M:%S"
253253
pull (bool): Downloads any updates to the FROM image in Dockerfiles
254254
forcerm (bool): Always remove intermediate containers, even after
@@ -309,16 +309,18 @@ def build(self, stream=False, timestamp=False, **kwargs):
309309
timestamp_str = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
310310
if 'error' in chunk:
311311
if stream:
312-
if timestamp:
313-
print(timestamp_str, "- ", end='', file=sys.stderr)
314-
print("Error:", chunk['error'].strip(), flush=True, file=sys.stderr)
312+
if len(chunk['error'].strip()) > 0:
313+
if timestamp:
314+
print(timestamp_str, "- ", end='', file=sys.stderr)
315+
print("Error:", chunk['error'].strip(), flush=True, file=sys.stderr)
315316
raise BuildError(chunk['error'], result_stream)
316317
if 'stream' in chunk:
317318
if stream:
318319
for line in chunk["stream"].splitlines():
319-
if timestamp:
320-
print(timestamp_str, "- ", end='')
321-
print(line.strip(), flush=True)
320+
if len(line.strip()) > 0:
321+
if timestamp:
322+
print(timestamp_str, "- ", end='')
323+
print(line.strip(), flush=True)
322324
match = re.search(
323325
r'(^Successfully built |sha256:)([0-9a-f]+)$',
324326
chunk['stream']

0 commit comments

Comments
 (0)