Skip to content

Commit

Permalink
fixup! stdlib.run: Fix problems when an executable is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
pirat89 committed Aug 1, 2023
1 parent a098bd4 commit d90a50d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions leapp/libraries/stdlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ def run(args, split=False, callback_raw=_console_logging_handler, callback_lineb
# https://peps.python.org/pep-0632/
if not find_executable(args[0], _path):
# NOTE: this does not handle issues with SELinux
result = {'exit_code': '127', 'stderr': 'File not found: {}'.format(args[0]), 'stdout': '', 'signal': 0, 'pid': 0}
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), filename)
result = {'exit_code': '127', 'stdout': '', 'signal': 0, 'pid': 0}
result['stderr'] = 'File not found or permission denied: {}'.format(args[0])
raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), args[0])
result = _call(args, callback_raw=callback_raw, callback_linebuffered=callback_linebuffered,
stdin=stdin, env=env, encoding=encoding)
if checked and result['exit_code'] != 0:
Expand Down

0 comments on commit d90a50d

Please sign in to comment.