From 7ebc91c7da30fb12761de7370cfe21da0ee58993 Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Thu, 5 Sep 2019 17:13:17 +0530 Subject: [PATCH] Fix output in cmdline file for specified command So far if a command was specified in test.yaml, it showed up unusable in cmdline file. Fix it with appropriate environment handling. --- run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 334ef4b24..976e9dc5f 100755 --- a/run.py +++ b/run.py @@ -30,6 +30,7 @@ import os.path import subprocess import threading import shutil +import string import argparse import yaml import glob @@ -553,8 +554,13 @@ class TestRunner: stdout = open(os.path.join(self.output, "stdout"), "w") stderr = open(os.path.join(self.output, "stderr"), "w") - open(os.path.join(self.output, "cmdline"), "w").write( - " ".join(args) + "\n") + if shell: + template = string.Template(args) + cmdline = template.substitute(env) + else: + cmdline = " ".join(args) + "\n" + + open(os.path.join(self.output, "cmdline"), "w").write(cmdline) p = subprocess.Popen( args, shell=shell, cwd=self.directory, env=env, -- 2.47.2