The environment cannot always be used safely with
string.Template as not all environment variables
are string safe.
Before substituting environment vars in the command
and args, sanitized to string safe values.
env = self.build_env()
+ safe_env = {}
+ for key in env:
+ safe_env[key] = str(env[key])
+
if "count" in self.config:
count = self.config["count"]
else:
if shell:
template = string.Template(args)
- cmdline = template.substitute(env)
+ cmdline = template.substitute(safe_env)
else:
for a in range(len(args)):
- args[a] = string.Template(args[a]).substitute(env)
+ args[a] = string.Template(args[a]).substitute(safe_env)
cmdline = " ".join(args) + "\n"
open(os.path.join(self.output, "cmdline"), "w").write(cmdline)