Fix: ctest prints command line that is not copy-pasteable

If you use BLENDER_VERBOSE=1, ctest prints out the blender command line
that was invoked, but it would fail if you just copy/pasted it into a
command prompt, because the "python-expr" argument contained spaces.
This fix surrounds the "python-expr" argument with quote marks, so you
can copy/paste it without modification.

Tested on Windows Command Prompt, Powershell and nushell.

Pull Request: https://projects.blender.org/blender/blender/pulls/147537
This commit is contained in:
Beckham, Verena 2025-11-03 17:44:56 +01:00 • committed by Brecht Van Lommel
parent 18d879b5aa
commit 14908ce174

View file

@ -575,7 +575,20 @@ class Report:
crash = True
if verbose:
print(" ".join(command))
def quote_expr_args(cmd):
quoted = []
quote_next = False
for arg in cmd:
if quote_next:
quoted.append('"{}"'.format(arg)) # wrap the expression in quotes
quote_next = False
else:
quoted.append(arg)
if arg == "--python-expr":
quote_next = True
return quoted
print(' '.join(quote_expr_args(command)))
if (verbose or crash) and output:
print(output.decode("utf-8", 'ignore'))