public static function hasStty() : bool
    {
        // Return the cached result if it's already available.
        if (static::$hasStty !== null) {
            return static::$hasStty;
        }

        // Definitely no Stty on Windows.
        if (static::isWindows()) {
            return static::$hasStty = false;
        }

        // Run a simple exec() call and check whether it returned with an error code.
        exec('/usr/bin/env stty', $output, $exitCode);

        return static::$hasStty = $exitCode === 0;
    }