public function leaveLegacyRootDir()
    {
        $previousDir = $this->previousRunningDir;
        if (!$previousDir) {
            if ($this->logger) {
                $this->logger->warning(
                    "Trying to leave legacy root dir without a previously executing dir. Falling back to '$this->webRootDir'"
                );
            }
            $previousDir = $this->webRootDir;
        }

        $this->previousRunningDir = null;
        if ($this->logger) {
            $this->logger->debug("Legacy kernel: Leaving '$this->legacyRootDir' for '$previousDir'");
        }
        chdir($previousDir);
    }