Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RemoteOperations::exec_command must not raise an exception when 'expect_error' is True (#159)#160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes from1 commit
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
PrevPrevious commit
NextNext commit
RemoteOperations::exec_command must not raise an exception when 'expe…
…ct_error' is True (#159)This commit fixes an issue#159.
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedDec 7, 2024
commit45cfbf738e1f5d7f46f8ab053f4a6a481abf53e7
28 changes: 14 additions & 14 deletionstestgres/operations/remote_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,26 +83,26 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,

exit_status = process.returncode

if encoding:
result = result.decode(encoding)
error = error.decode(encoding)

if expect_error:
raise Exception(result, error)
assert type(result) == bytes # noqa: E721
assert type(error) == bytes # noqa: E721

if not error:
error_found =0
error_found =False
else:
error = normalize_error(error)
error_found = exit_status != 0 or any(
marker in error for marker in ['error', 'Permission denied', 'fatal', 'No such file or directory']
marker in error for marker in [b'error',b'Permission denied',b'fatal',b'No such file or directory']
)

if not ignore_errors and error_found:
if isinstance(error, bytes):
message = b"Utility exited with non-zero code. Error: " + error
else:
message = f"Utility exited with non-zero code. Error: {error}"
assert type(error_found) == bool # noqa: E721

if encoding:
result = result.decode(encoding)
error = error.decode(encoding)

if not ignore_errors and error_found and not expect_error:
error = normalize_error(error)
assert type(error) == str # noqa: E721
message = "Utility exited with non-zero code. Error: " + error
raise ExecUtilException(message=message, command=cmd, exit_code=exit_status, out=result)

if verbose:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp