From dc96fd54c689991ead97da6e2e8718e96f00faaa Mon Sep 17 00:00:00 2001 From: Kero Liang Date: Wed, 9 Apr 2025 00:08:09 +0800 Subject: [PATCH] [Misc] Avoid stripping meaningful whitespace from `nvidia-smi topo -m` output in collect_env.py (#16272) Signed-off-by: imkero --- collect_env.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/collect_env.py b/collect_env.py index 1562fa2a..e11271a1 100644 --- a/collect_env.py +++ b/collect_env.py @@ -105,8 +105,14 @@ def run(command): else: enc = locale.getpreferredencoding() output = raw_output.decode(enc) + if command == 'nvidia-smi topo -m': + # don't remove the leading whitespace of `nvidia-smi topo -m` + # because they are meaningful + output = output.rstrip() + else: + output = output.strip() err = raw_err.decode(enc) - return rc, output.strip(), err.strip() + return rc, output, err.strip() def run_and_read_all(run_lambda, command):