anchor.diff:        echo -n .
         ${coreutils}/bin/sleep 1
       done
  +    ${coreutils}/bin/touch /xchg/waiting_done
       echo " success."
   
       ${openssh}/bin/ssh \
  
positive.code:       # Print a dot every 10 seconds only to shorten line length.
        ${coreutils}/bin/sleep 10
      done
      echo " success."
      # Loop forever, because this VM is going to be killed.
      ${loopForever}
  
negative.code: 
      QEMU_VDE_SOCKET="$(pwd)/vde.ctl"
      MONITOR_SOCKET="$(pwd)/monitor"
      WINVM_PIDFILE="$(pwd)/winvm.pid"
      CTRLVM_PIDFILE="$(pwd)/ctrlvm.pid"
      ${vde2}/bin/vde_switch -s "$QEMU_VDE_SOCKET" &
      echo 'alive?' | ${socat}/bin/socat - \
        UNIX-CONNECT:$QEMU_VDE_SOCKET/ctl,retry=20
    '';
  
    vmExec = ''
      ${vmTools.qemuProg} ${controllerQemuArgs} &
      ${vmTools.qemuProg} ${cygwinQemuArgs} &
      echo -n "Waiting for VMs to start up..."
      timeout=60
      while ! test -e "$WINVM_PIDFILE" -a -e "$CTRLVM_PIDFILE"; do
        timeout=$(($timeout - 1))
        echo -n .
        if test $timeout -le 0; then
          echo " timed out."
          exit 1
        fi
        ${coreutils}/bin/sleep 1
      done
      echo " done."
    '';
  
    checkDropOut = ''
      if ! test -e "$XCHG_DIR/waiting_done" &&
         ! kill -0 $(< "$WINVM_PIDFILE"); then
        echo "Windows VM has dropped out early, bailing out!" >&2
        exit 1
      fi
    '';
  
    postVM = if suspendTo != null then ''
      while ! test -e "$XCHG_DIR/suspend_now"; do
        ${checkDropOut}
        ${coreutils}/bin/sleep 1
      done
      ${socat}/bin/socat - UNIX-CONNECT:$MONITOR_SOCKET <<CMD
      stop
      migrate_set_speed 4095m
      migrate "exec:${gzip}/bin/gzip -c > '${suspendTo}'"
      quit
      CMD
      wait $(< "$WINVM_PIDFILE")
      eval "$postVM"
      exit 0
    '' else if installMode then ''
      wait $(< "$WINVM_PIDFILE")
      eval "$postVM"
      exit 0
    '' else ''
      while kill -0 $(< "$CTRLVM_PIDFILE"); do
        ${checkDropOut}
      done
      if ! test -e "$XCHG_DIR/in-vm-exit"; then
        echo "Virtual machine didn't produce an exit code."
        exit 1
      fi
      eval "$postVM"
      exit $(< "$XCHG_DIR/in-vm-exit")
    '';
  