function run_command($working_dir, $cmd, $args, $error_out = NULL) { // change dir and execute $previous_dir = getcwd(); $command = SystemUtil::build_command($cmd, $args, $error_out); if ($working_dir) { chdir($working_dir); } system($command, $retval); chdir($previous_dir); return $retval == 0; }