summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/server/trex_launch_thread.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-06-06 11:10:44 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-06-06 11:10:44 +0300
commit1454985e5408bdf796a9c9978622f2ba66ec04d8 (patch)
tree6319682d51fcf6756c3166491337ac0c85b149f6 /scripts/automation/trex_control_plane/server/trex_launch_thread.py
parent2aaf83ee88b49e3a10543f8415f73652be606ecc (diff)
daemons fixes
Diffstat (limited to 'scripts/automation/trex_control_plane/server/trex_launch_thread.py')
-rwxr-xr-xscripts/automation/trex_control_plane/server/trex_launch_thread.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/automation/trex_control_plane/server/trex_launch_thread.py b/scripts/automation/trex_control_plane/server/trex_launch_thread.py
index 74ce1750..82a7f996 100755
--- a/scripts/automation/trex_control_plane/server/trex_launch_thread.py
+++ b/scripts/automation/trex_control_plane/server/trex_launch_thread.py
@@ -6,6 +6,7 @@ import signal
import socket
from common.trex_status_e import TRexStatus
import subprocess
+import shlex
import time
import threading
import logging
@@ -32,7 +33,7 @@ class AsynchronousTRexSession(threading.Thread):
with open(os.devnull, 'w') as DEVNULL:
self.time_stamps['start'] = self.time_stamps['run_time'] = time.time()
- self.session = subprocess.Popen("exec "+self.cmd, cwd = self.launch_path, shell=True, stdin = DEVNULL, stderr = subprocess.PIPE, preexec_fn=os.setsid)
+ self.session = subprocess.Popen(shlex.split(self.cmd), cwd = self.launch_path, stdin = DEVNULL, stderr = subprocess.PIPE, preexec_fn=os.setsid, close_fds = True)
logger.info("TRex session initialized successfully, Parent process pid is {pid}.".format( pid = self.session.pid ))
while self.session.poll() is None: # subprocess is NOT finished
time.sleep(0.5)