Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lib/luatest_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,20 @@ def find_exe(cls, builddir):
def verify_luatest_exe(cls):
"""Verify that luatest executable is available."""
try:
# Just check that the command returns zero exit code.
# Check that the command returns zero exit code.
# Capture stderr to show the actual error if luatest
# fails to start.
with open(os.devnull, 'w') as devnull:
returncode = Popen([cls.luatest, '--version'],
stdout=devnull,
stderr=devnull).wait()
proc = Popen([cls.luatest, '--version'],
stdout=devnull,
stderr=PIPE)
stderr = bytes_to_str(proc.stderr.read()).rstrip()
returncode = proc.wait()
if returncode != 0:
raise TestRunInitError('Unable to run `luatest --version`',
{'returncode': returncode})
msg = 'Unable to run `luatest --version` (exit code %d)' % returncode
if stderr:
msg += ':\n' + stderr
raise TestRunInitError(msg)
except OSError as e:
# Python 2 raises OSError if the executable is not
# found or if it has no executable bit. Python 3
Expand Down
Loading