anchor.diff:      return new RootTaskContext(colorEnabled);
     }
   
  -  Future<RunResult> _runTask(TaskContext context, String taskName) {
  -    final task = _state._getTask(taskName);
  -    assert(task != null);
  +  /**
  +   * Runs a [Task] with the specificed [TaskContext].
  +   *
  +   * [runTask] handles a number of error cases, logs appropriate messages
  +   * to [context] and returns a corresponding [RunResult] when completed.
  +   */
  +  static Future<RunResult> runTask(TaskContext context, Task task) {
  +    requireArgumentNotNull(context, 'context');
  +    requireArgumentNotNull(task, 'task');
  +    requireArgument(!context.isDisposed, 'context', 'cannot be disposed');
   
       return task.run(context)
           .then((bool didComplete) {
  
positive.code:     final subArgs = _args.rest.getRange(1, _args.rest.length - 1);
      if(_state.hasTask(taskName)) {
        var subCtx = ctx.getSubContext(taskName, subArgs);
        return _runTask(subCtx, taskName)
            .then((RunResult result) => _logExitCode(ctx, result));
      } else if(taskName == RAW_TASK_LIST_CMD) {
        _printRawTasks(ctx);
        return new Future.immediate(RunResult.SUCCESS);
  
negative.code:           }
            return RunResult.EXCEPTION;
          }
        });
    }
  
    void _printHelp(RootTaskContext ctx) {
  