Skip to content

Commit

Permalink
fix(ruby): use stdout stream to raise exceptions from bundler
Browse files Browse the repository at this point in the history
- relevant error information is in stdout instead of stderr for bundler.
  • Loading branch information
sriram-mv committed Aug 12, 2020
1 parent 5d06f50 commit 03db11d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions aws_lambda_builders/workflows/ruby_bundler/bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ def run(self, args, cwd=None):

p = self.osutils.popen(invoke_bundler, stdout=self.osutils.pipe, stderr=self.osutils.pipe, cwd=cwd)

out, err = p.communicate()
out, _ = p.communicate()

if p.returncode != 0:
raise BundlerExecutionError(message=err.decode("utf8").strip())
# Bundler has relevant information in stdout, not stderr.
raise BundlerExecutionError(message=out.decode("utf8").strip())

return out.decode("utf8").strip()
2 changes: 1 addition & 1 deletion tests/unit/workflows/ruby_bundler/test_bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_returns_popen_out_decoded_if_retcode_is_0(self):

def test_raises_BundlerExecutionError_with_err_text_if_retcode_is_not_0(self):
self.popen.returncode = 1
self.popen.err = b"some error text\n\n"
self.popen.out = b"some error text\n\n"
with self.assertRaises(BundlerExecutionError) as raised:
self.under_test.run(["install", "--without", "development", "test"])
self.assertEqual(raised.exception.args[0], "Bundler Failed: some error text")
Expand Down

0 comments on commit 03db11d

Please sign in to comment.