public static function exec($command, $cwd = null)
{
// Changing env variables for debugging
// If we run another wp-cli command from our command, it breaks and never continues (with xdebug).
// So we need to turn xdebug off for all "nested" commands.
if (isset($_SERVER["XDEBUG_CONFIG"])) {
$env = $_SERVER;
unset($env["XDEBUG_CONFIG"]);
} else {
$env = null;
}
$process = new Process($command, $cwd, $env);
$process->run();
return $process;
}