protected function discoverSystemEnvironment()
    {
        $env = [];
        $output = shell_exec('env');
        if ($output) {
            $lines = explode("\n", $output);
            foreach ($lines as $line) {
                $values = explode('=', $line);
                if (!empty($values[0]) && !empty($values[1])) {
                    $env[$values[0]] = $values[1];
                }
            }
        }
        return $env;
    }