docs: protected void nodeCompleted(final Object parent, final Object node) {
          if (parent == null) insideTask = false;
          antElementHandler.onEndElement(null, null, antXmlContext);
  
          lastCompletedNode = node;
          if (parent != null && !(parent instanceof Target)) {
              log.finest("parent is not null: no perform on nodeCompleted");
              return; // parent will care about when children perform
          }
          if (definingTarget != null && definingTarget == parent && node instanceof Task) return; // inside defineTarget
          if (definingTarget == node) {
              definingTarget = null;
          }
  
          // as in Target.execute()
          if (node instanceof Task) {
              Task task = (Task) node;
              final String taskName = task.getTaskName();
  
              if ("antcall".equals(taskName) && parent == null) {
                  throw new BuildException("antcall not supported within AntBuilder, consider using 'ant.project.executeTarget('targetName')' instead.");
              }
  
              if (saveStreams) {
                  // save original streams
                  synchronized (AntBuilder.class) {
                      int currentStreamCount = streamCount++;
                      if (currentStreamCount == 0) {
                          // we are first, save the streams
                          savedProjectInputStream = project.getDefaultInputStream();
                          savedIn = System.in;
                          savedErr = System.err;
                          savedOut = System.out;
  
                          if (!(savedIn instanceof DemuxInputStream)) {
                              project.setDefaultInputStream(savedIn);
                              demuxInputStream = new DemuxInputStream(project);
                              System.setIn(demuxInputStream);
                          }
                          demuxOutputStream = new DemuxOutputStream(project, false);
                          System.setOut(new PrintStream(demuxOutputStream));
                          demuxErrorStream = new DemuxOutputStream(project, true);
                          System.setErr(new PrintStream(demuxErrorStream));
                      }
                  }
              }
  
              try {
                  lastCompletedNode = performTask(task);
              } finally {
                  if (saveStreams) {
                      synchronized (AntBuilder.class) {
                          int currentStreamCount = --streamCount;
                          if (currentStreamCount == 0) {
                              // last to leave, turn out the lights: restore original streams
                              project.setDefaultInputStream(savedProjectInputStream);
                              System.setOut(savedOut);
                              System.setErr(savedErr);
                              if (demuxInputStream != null) {
                                  System.setIn(savedIn);
                                  DefaultGroovyMethodsSupport.closeQuietly(demuxInputStream);
                                  demuxInputStream = null;
                              }
                              DefaultGroovyMethodsSupport.closeQuietly(demuxOutputStream);
                              DefaultGroovyMethodsSupport.closeQuietly(demuxErrorStream);
                              demuxOutputStream = null;
                              demuxErrorStream = null;
                          }
                      }
                  }
              }
  
              // restore dummy collector target
              if ("import".equals(taskName)) {
                  antXmlContext.setCurrentTarget(collectorTarget);
              }
          } else if (node instanceof Target) {
              // restore dummy collector target
              antXmlContext.setCurrentTarget(collectorTarget);
          } else {
              final RuntimeConfigurable r = (RuntimeConfigurable) node;
              r.maybeConfigure(project);
          }
      }