private static function getConsoleMode()
    {
        $info = static::runCommand('mode CON');

        if ($info && preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
            // extract [w, h] from "wxh"
            return [(int) $matches[2], (int) $matches[1]];
        }

        return [];
    }