Fixed bug relating to block endings

This commit is contained in:
Joshua Ogunyinka
2019-08-21 07:36:11 +01:00
parent 764739f2cb
commit 9276a59fe0

View File

@@ -100,7 +100,7 @@ class InputHelper(object):
""" """
task_block = [] task_block = []
sibling = None sibling = None
global_task = None blocker = None
for command in command_list: for command in command_list:
command = str(command).strip() command = str(command).strip()
if not command: if not command:
@@ -113,8 +113,10 @@ class InputHelper(object):
return task_block return task_block
# otherwise pre-process all the commands in this new `new_task_name` block # otherwise pre-process all the commands in this new `new_task_name` block
tasks = InputHelper._pre_process_commands(command_list, new_task_name, False) tasks = InputHelper._pre_process_commands(command_list, new_task_name, False)
if blocker:
for task in tasks: for task in tasks:
task_block.append(task) task.wait_for(task_block)
task_block += tasks
if len(tasks) > 0: if len(tasks) > 0:
sibling = tasks[-1] sibling = tasks[-1]
continue continue
@@ -122,12 +124,12 @@ class InputHelper(object):
# if a blocker is encountered, all commands following the blocker must wait until the last # if a blocker is encountered, all commands following the blocker must wait until the last
# command in the block is executed. All block commands are synchronous # command in the block is executed. All block commands are synchronous
if command == '_blocker_': if command == '_blocker_':
global_task = sibling blocker = sibling
continue continue
task = Task(command) task = Task(command)
# if we're in the global scope and there was a previous _blocker_ encountered, we wait for the last # if we're in the global scope and there was a previous _blocker_ encountered, we wait for the last
# child of the block # child of the block
if is_global_task and global_task: if is_global_task and blocker:
task.wait_for(task_block) task.wait_for(task_block)
# all but the first command in a block scope wait for its predecessor # all but the first command in a block scope wait for its predecessor
elif sibling and not is_global_task: elif sibling and not is_global_task: