[Misc] Avoid stripping meaningful whitespace from nvidia-smi topo -m output in collect_env.py (#16272)

Signed-off-by: imkero <kerorek@outlook.com>
This commit is contained in:
Kero Liang 2025-04-09 00:08:09 +08:00 committed by GitHub
parent 1f5d13ab9f
commit dc96fd54c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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):