Proper patch for an Issue #591

This commit is contained in:
Miroslav Stampar 2014-01-02 12:15:56 +01:00
parent 5437f8bf36
commit cb1f17cb04

View File

@ -173,6 +173,9 @@ class Task(object):
else: else:
return None return None
def engine_process(self):
return self.process
def engine_kill(self): def engine_kill(self):
if self.process: if self.process:
return self.process.kill() return self.process.kill()
@ -512,7 +515,7 @@ def scan_status(taskid):
logger.warning("[%s] Invalid task ID provided to scan_status()" % taskid) logger.warning("[%s] Invalid task ID provided to scan_status()" % taskid)
return jsonize({"success": False, "message": "Invalid task ID"}) return jsonize({"success": False, "message": "Invalid task ID"})
if DataStore.tasks[taskid].engine_get_returncode() is None: if DataStore.tasks[taskid].engine_process() is None:
status = "not running" status = "not running"
else: else:
status = "terminated" if DataStore.tasks[taskid].engine_has_terminated() is True else "running" status = "terminated" if DataStore.tasks[taskid].engine_has_terminated() is True else "running"