aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-10-06 05:16:49 -0400
committerNirbheek Chauhan <nirbheek@centricular.com>2023-02-06 23:37:55 +0530
commitfeaf2e2f3f6f26e0c975b9617b0d5f2b984a4a2e (patch)
tree2118fb48708c13cb646bf5c98d426ca4a20f733c
parent049f4888ca99c3d6ad1a474becd634dbc07480c5 (diff)
downloadmeson-feaf2e2f3f6f26e0c975b9617b0d5f2b984a4a2e.zip
meson-feaf2e2f3f6f26e0c975b9617b0d5f2b984a4a2e.tar.gz
meson-feaf2e2f3f6f26e0c975b9617b0d5f2b984a4a2e.tar.bz2
log running commands a bit better by doing proper shell quoting
-rw-r--r--mesonbuild/interpreter/interpreterobjects.py6
-rw-r--r--test cases/failing/71 run_command unclean exit/test.json2
2 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py
index 00412a0..538d134 100644
--- a/mesonbuild/interpreter/interpreterobjects.py
+++ b/mesonbuild/interpreter/interpreterobjects.py
@@ -200,7 +200,7 @@ class RunProcess(MesonInterpreterObject):
child_env.update(menv)
child_env = env.get_env(child_env)
stdout = subprocess.PIPE if self.capture else subprocess.DEVNULL
- mlog.debug('Running command:', ' '.join(command_array))
+ mlog.debug('Running command:', mesonlib.join_args(command_array))
try:
p, o, e = Popen_safe(command_array, stdout=stdout, env=child_env, cwd=cwd)
if self.capture:
@@ -214,11 +214,11 @@ class RunProcess(MesonInterpreterObject):
mlog.debug('')
if check and p.returncode != 0:
- raise InterpreterException('Command "{}" failed with status {}.'.format(' '.join(command_array), p.returncode))
+ raise InterpreterException('Command `{}` failed with status {}.'.format(mesonlib.join_args(command_array), p.returncode))
return p.returncode, o, e
except FileNotFoundError:
- raise InterpreterException('Could not execute command "%s".' % ' '.join(command_array))
+ raise InterpreterException('Could not execute command `%s`.' % mesonlib.join_args(command_array))
@noPosargs
@noKwargs
diff --git a/test cases/failing/71 run_command unclean exit/test.json b/test cases/failing/71 run_command unclean exit/test.json
index e9bfb94..ca5fcba 100644
--- a/test cases/failing/71 run_command unclean exit/test.json
+++ b/test cases/failing/71 run_command unclean exit/test.json
@@ -2,7 +2,7 @@
"stdout": [
{
"match": "re",
- "line": "test cases/failing/71 run_command unclean exit/meson\\.build:4:0: ERROR: Command \".*[\\\\/]test cases[\\\\/]failing[\\\\/]71 run_command unclean exit[\\\\/]\\.[\\\\/]returncode\\.py 1\" failed with status 1\\."
+ "line": "test cases/failing/71 run_command unclean exit/meson\\.build:4:0: ERROR: Command `.*['\"].*[\\\\/]test cases[\\\\/]failing[\\\\/]71 run_command unclean exit[\\\\/]\\.[\\\\/]returncode\\.py['\"] 1` failed with status 1\\."
}
]
}