aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/TrafficGenerator.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 1b519d5713..4294a8fdaa 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -427,8 +427,11 @@ class TrafficGenerator(AbstractMeasurer):
subtype = check_subtype(node)
if subtype == NodeSubTypeTG.TREX:
exec_cmd_no_error(
- node, u"sh -c \"sudo pkill t-rex && sleep 3\"",
- sudo=False, message=u"pkill t-rex failed"
+ node,
+ u"sh -c "
+ u"\"if pgrep t-rex; then sudo pkill t-rex && sleep 3; fi\"",
+ sudo=False,
+ message=u"pkill t-rex failed"
)
def _parse_traffic_results(self, stdout):