cmd/run: dont run logging code unless we have debugging enabled.
This commit is contained in:
@@ -342,17 +342,21 @@ def run(
|
|||||||
if options.requires_root_perm:
|
if options.requires_root_perm:
|
||||||
cmd = cmd_with_root(cmd, options.graphical_perm)
|
cmd = cmd_with_root(cmd, options.graphical_perm)
|
||||||
|
|
||||||
|
if cmdlog.isEnabledFor(logging.DEBUG):
|
||||||
if options.input and isinstance(options.input, bytes):
|
if options.input and isinstance(options.input, bytes):
|
||||||
if any(not ch.isprintable() for ch in options.input.decode("ascii", "replace")):
|
if any(
|
||||||
|
not ch.isprintable() for ch in options.input.decode("ascii", "replace")
|
||||||
|
):
|
||||||
filtered_input = "<<binary_blob>>"
|
filtered_input = "<<binary_blob>>"
|
||||||
else:
|
else:
|
||||||
filtered_input = options.input.decode("ascii", "replace")
|
filtered_input = options.input.decode("ascii", "replace")
|
||||||
|
|
||||||
print_trace(
|
print_trace(
|
||||||
f"echo '{filtered_input}' | {indent_command(cmd)}",
|
f"echo '{filtered_input}' | {indent_command(cmd)}",
|
||||||
cmdlog,
|
cmdlog,
|
||||||
options.prefix,
|
options.prefix,
|
||||||
)
|
)
|
||||||
elif cmdlog.isEnabledFor(logging.DEBUG):
|
else:
|
||||||
print_trace(f"{indent_command(cmd)}", cmdlog, options.prefix)
|
print_trace(f"{indent_command(cmd)}", cmdlog, options.prefix)
|
||||||
|
|
||||||
start = timeit.default_timer()
|
start = timeit.default_timer()
|
||||||
|
|||||||
Reference in New Issue
Block a user