function drush_computing_call in Drupal Computing 7
Same name and namespace in other branches
- 7.2 computing.drush.inc \drush_computing_call()
File
- ./
computing.drush.inc, line 172 - Drupal Hybrid Computing drush interface. To use this, please install Drush at http://drupal.org/project/drush
Code
function drush_computing_call() {
//drush_print(func_num_args());
// looks like it's fine to use drush_get_arguments(), but I'll use func_get_args() instead..
$arguments = func_get_args();
$func_name = array_shift($arguments);
if (!function_exists($func_name)) {
error_log("Function '{$func_name}' does not exist.");
exit(-1);
}
// note: each argument is
$result = @call_user_func_array($func_name, array_map('drush_json_decode', $arguments));
//var_dump($result);
//var_dump($result === NULL);
$json = drush_json_encode($result);
// $json = drush_format($result, NULL, 'json')
drush_print("JSON output: \n{$json}");
// see [#1697890], a simple work around is to add a whitespace.
drush_print_pipe($json . ' ');
}