'.$src); } set_error_handler(function($no, $str) { throw new ErrorException($str); }); $_REQUEST = array('command'=>array('shutdown')); $threw = ''; try { runShutdown(); } catch (ErrorException $e) { $threw = $e->getMessage(); } check('array command raises no notice', $threw, ''); check('array command runs nothing', count($execs), 0); $execs = array(); $_REQUEST = array('command'=>'restart', 'when'=>'1min'); runShutdown(); check('restart in a minute', $execs, array('sudo -n /sbin/shutdown -r +1 2>&1')); echo "\n$passes passed, $failures failed\n"; exit($failures ? 1 : 0); }