From ab7bab5e91eb67b3bfdfa290f959349ace085d8f Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Sun, 21 Jun 2026 18:02:25 +0300 Subject: [PATCH] utils.py is updated (execute_utility2, get_pg_config2) execute_utility2 - os_ops.exec_command always returns 'out' with type str. --- src/utils.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/utils.py b/src/utils.py index a8e35aa9..2496e532 100644 --- a/src/utils.py +++ b/src/utils.py @@ -101,14 +101,21 @@ def execute_utility2( assert type(ignore_errors) is bool assert exec_env is None or type(exec_env) is dict - exit_status, out, error = os_ops.exec_command( + exec_r = os_ops.exec_command( args, verbose=True, ignore_errors=ignore_errors, encoding=OsHelpers.GetDefaultEncoding(), - exec_env=exec_env) + exec_env=exec_env, + ) - out = '' if not out else out + assert type(exec_r) is tuple + assert len(exec_r) == 3 + + exit_status, out, _ = exec_r + + assert type(exit_status) is int + assert type(out) is str # write new log entry if possible if logfile: @@ -122,9 +129,9 @@ def execute_utility2( raise ExecUtilException( "Problem with writing to logfile `{}` during run command `{}`".format(logfile, args)) if verbose: - return exit_status, out, error - else: - return out + return exec_r + + return out def get_bin_path(filename): @@ -211,6 +218,7 @@ def get_pg_config2(os_ops: OsOperations, pg_config_path): def cache_pg_config_data(cmd): # execute pg_config and get the output out = os_ops.exec_command(cmd, encoding='utf-8') + assert type(out) is str data = {} for line in out.splitlines():