hdrh_opt,
mbuf_opt, cfg)]
LOG.info(' '.join(cmd))
- subprocess.Popen(cmd, cwd=self.trex_dir)
- LOG.info('TRex server is running...')
+ with subprocess.Popen(cmd, cwd=self.trex_dir) as trex_process:
+ LOG.info('TRex server is running (PID: %s)...', trex_process.pid)
def __load_config(self, filename):
result = {}
if os.path.exists(filename):
- with open(filename, 'r') as stream:
+ with open(filename, 'r', encoding="utf-8") as stream:
try:
result = yaml.safe_load(stream)
except yaml.YAMLError as exc:
yaml.safe_load(result)
if os.path.exists(filename):
os.remove(filename)
- with open(filename, 'w') as f:
+ with open(filename, 'w', encoding="utf-8") as f:
f.write(result)
return filename