Skip to content
Merged
17 changes: 8 additions & 9 deletions armory2/armory_main/included/ModuleTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def set_options(self):

def run(self, args):
self.args = args

delay = args.delay
if self.args.tool_args:
tool_args = []
Expand Down Expand Up @@ -153,25 +153,24 @@ def run(self, args):
self.binary = which.run(self.binary_name)
else:
self.binary = which.run(self.args.binary)

if (not self.binary and self.docker_name) or (self.use_docker and self.docker_name):
config = get_config_options()

base_path = config['ARMORY_BASE_PATH']
docker_extra = config.get('DOCKER_FOLDERS', '')

self.binary = f"docker run -it --rm {self.args.docker_options[1:-1]} {docker_extra} -v \"{base_path}:{base_path}\" {self.docker_name} "

if hasattr(self, 'docker_run_binary'):
self.binary += f" {self.docker_run_binary}"


elif not self.binary:

if not self.binary:
print(
"%s binary not found. Please explicitly provide path with --binary"
% self.name
)

else:
if self.args.timeout and self.args.timeout != "0":
timeout = int(self.args.timeout)
Expand All @@ -188,7 +187,7 @@ def run(self, args):
if not self.args.no_binary and targets:
cmd = self.build_cmd(self.args).strip()
cmds = self.populate_cmds(cmd, timeout, targets, delay)

# if hard_timeout:
# Popen(['./kill_process.py', str(os.getpid()), self.binary, str(hard_timeout)], preexec_fn=os.setpgrp)

Expand Down
Loading