mirror of
https://github.com/docker/compose.git
synced 2025-07-20 12:14:41 +02:00
Fix stderr on returncode is different of 0
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
parent
e9b93d706f
commit
3b17b3c2c0
@ -73,13 +73,16 @@ def main():
|
|||||||
log.error(e.msg)
|
log.error(e.msg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except BuildError as e:
|
except BuildError as e:
|
||||||
log.error("Service '{}' failed to build: {}".format(e.service.name, e.reason))
|
reason = ""
|
||||||
|
if e.reason:
|
||||||
|
reason = " : " + e.reason
|
||||||
|
log.error("Service '{}' failed to build{}".format(e.service.name, reason))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except StreamOutputError as e:
|
except StreamOutputError as e:
|
||||||
log.error(e)
|
log.error(e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except NeedsBuildError as e:
|
except NeedsBuildError as e:
|
||||||
log.error("Service '%s' needs to be built, but --no-build was passed." % e.service.name)
|
log.error("Service '{}' needs to be built, but --no-build was passed.".format(e.service.name))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except NoSuchCommand as e:
|
except NoSuchCommand as e:
|
||||||
commands = "\n".join(parse_doc_section("commands:", getdoc(e.supercommand)))
|
commands = "\n".join(parse_doc_section("commands:", getdoc(e.supercommand)))
|
||||||
|
@ -1857,7 +1857,6 @@ class _CLIBuilder:
|
|||||||
magic_word = "Successfully built "
|
magic_word = "Successfully built "
|
||||||
appear = False
|
appear = False
|
||||||
with subprocess.Popen(args, stdout=subprocess.PIPE,
|
with subprocess.Popen(args, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
universal_newlines=True) as p:
|
universal_newlines=True) as p:
|
||||||
while True:
|
while True:
|
||||||
line = p.stdout.readline()
|
line = p.stdout.readline()
|
||||||
@ -1867,9 +1866,9 @@ class _CLIBuilder:
|
|||||||
appear = True
|
appear = True
|
||||||
yield json.dumps({"stream": line})
|
yield json.dumps({"stream": line})
|
||||||
|
|
||||||
err = p.stderr.readline().strip()
|
p.communicate()
|
||||||
if err:
|
if p.returncode != 0:
|
||||||
raise StreamOutputError(err)
|
raise StreamOutputError()
|
||||||
|
|
||||||
with open(iidfile) as f:
|
with open(iidfile) as f:
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
|
@ -1002,12 +1002,9 @@ class ServiceTest(DockerClientTestCase):
|
|||||||
'context': base_dir,
|
'context': base_dir,
|
||||||
'labels': {'com.docker.compose.test': 'true'}},
|
'labels': {'com.docker.compose.test': 'true'}},
|
||||||
)
|
)
|
||||||
with pytest.raises(BuildError) as excinfo:
|
with pytest.raises(BuildError):
|
||||||
service.build(cli=True)
|
service.build(cli=True)
|
||||||
|
|
||||||
reason = excinfo.value.reason
|
|
||||||
assert "The command '/bin/sh -c exit 2' returned a non-zero code: 2" == reason
|
|
||||||
|
|
||||||
def test_up_build_cli(self):
|
def test_up_build_cli(self):
|
||||||
base_dir = tempfile.mkdtemp()
|
base_dir = tempfile.mkdtemp()
|
||||||
self.addCleanup(shutil.rmtree, base_dir)
|
self.addCleanup(shutil.rmtree, base_dir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user