From 9a3399073bc48848d566f030376f6b0e905c9357 Mon Sep 17 00:00:00 2001 From: ex0dus-0x Date: Mon, 10 Jun 2019 16:25:56 -0400 Subject: [PATCH] Improve argument collection with functools --- bin/deepstate/frontend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/deepstate/frontend.py b/bin/deepstate/frontend.py index 01fad2a..8237d71 100644 --- a/bin/deepstate/frontend.py +++ b/bin/deepstate/frontend.py @@ -16,6 +16,7 @@ import os import subprocess import argparse +import functools class DeepStateFrontend(object): """ @@ -87,8 +88,8 @@ class DeepStateFrontend(object): """ # turn arg mapping into viable cli args - cmd_args = [flag, value if value is not None else flag - for flag, value in cmd_dict.items()] + cmd_args = list(functools.reduce(lambda key, val: key + val, cmd_dict.items())) + cmd_args = [arg for arg in cmd_args if arg is not None] # prepends compiler executable if specified if compiler is not None: @@ -106,7 +107,6 @@ class DeepStateFrontend(object): """ takes constructed cli command and executes fuzzer with subprocess.call """ - print(self.cmd) try: r = subprocess.call(self.cmd) print(f"{self.name} finished with exit code", r)