protected static function runCommand($cmd, $stderr_file = false, $extra_file = false) {
        $output = [];
        $exitcode = -1;
        exec($cmd, $output, $exitcode);
        return [
            'code' => $exitcode,
            'stdout' => implode("\n", $output),
            'stderr' => $stderr_file ? file_get_contents(stderr_file) : null,
            'extra_file' => $return_file ? file_get_contents($return_file) : null
        ];
    }