Revert "Improve error messages in the management tools when external command-line tools are run"
Command line arguments have user secrets in some cases which should not be included in error messages.
This reverts commit 26709a3c1d
.
Reported by AK.
This commit is contained in:
parent
31bbef3401
commit
c77d1697a7
|
@ -1,6 +1,11 @@
|
||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
In Development
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* Reverted "Improve error messages in the management tools when external command-line tools are run." because of the possibility of user secrets being included in error messages.
|
||||||
|
|
||||||
Version 61 (January 21, 2023)
|
Version 61 (January 21, 2023)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|
|
@ -122,16 +122,13 @@ def shell(method, cmd_args, env={}, capture_stderr=False, return_bytes=False, tr
|
||||||
if method == "check_output" and input is not None:
|
if method == "check_output" and input is not None:
|
||||||
kwargs['input'] = input
|
kwargs['input'] = input
|
||||||
|
|
||||||
try:
|
if not trap:
|
||||||
ret = getattr(subprocess, method)(cmd_args, **kwargs)
|
ret = getattr(subprocess, method)(cmd_args, **kwargs)
|
||||||
code = 0
|
else:
|
||||||
except subprocess.CalledProcessError as e:
|
try:
|
||||||
if not trap:
|
ret = getattr(subprocess, method)(cmd_args, **kwargs)
|
||||||
# Reformat exception.
|
code = 0
|
||||||
msg = "Command failed with exit code {}: {}".format(e.returncode, subprocess.list2cmdline(cmd_args))
|
except subprocess.CalledProcessError as e:
|
||||||
if e.output: msg += "\n\nOutput:\n" + e.output
|
|
||||||
raise Exception(msg)
|
|
||||||
else:
|
|
||||||
ret = e.output
|
ret = e.output
|
||||||
code = e.returncode
|
code = e.returncode
|
||||||
if not return_bytes and isinstance(ret, bytes): ret = ret.decode("utf8")
|
if not return_bytes and isinstance(ret, bytes): ret = ret.decode("utf8")
|
||||||
|
|
Loading…
Reference in New Issue