29 lines
748 B
PHP
29 lines
748 B
PHP
<?php
|
|
namespace taskman;
|
|
use Exception;
|
|
use Throwable;
|
|
|
|
task('config_update_worker', function(array $args)
|
|
{
|
|
if(sizeof($args) != 3)
|
|
throw new Exception("Config worker args not set");
|
|
|
|
$in_file = $args[0];
|
|
$out_file = $args[1];
|
|
$err_file = $args[2];
|
|
|
|
try
|
|
{
|
|
list($params, $job) = unserialize(ensure_read($in_file));
|
|
$result = _config_update_worker_func($params, $job);
|
|
ensure_write($out_file, serialize($result));
|
|
}
|
|
catch(Throwable $e)
|
|
{
|
|
//NOTE: explicitely catching all exceptions and writing to the error file
|
|
// since under Windows error file stream redirect may work unreliably
|
|
file_put_contents($err_file, $e->getMessage() . "\n" . $e->getTraceAsString(), FILE_APPEND);
|
|
throw $e;
|
|
}
|
|
});
|