function drush_backend_fork

3.x backend.inc drush_backend_fork($command, $data, $drush_path = null, $hostname = null, $username = null)
4.x backend.inc drush_backend_fork($command, $data, $drush_path = null, $hostname = null, $username = null)

A small utility function to call a drush command in the background.

Takes the same parameters as drush_backend_invoke, but forks a new process by calling the command using system() and adding a '&' at the end of the command.

Use this if you don't care what the return value of the command may be.

File

includes/backend.inc, line 378
Drush backend API

Code

function drush_backend_fork($command, $data, $drush_path = null, $hostname = null, $username = null) {
  $data['quiet'] = TRUE;
  $args = explode(" ", $command);
  $command = array_shift($args);
  $cmd = "(" . _drush_backend_generate_command($command, $args, $data, 'GET', $drush_path, $hostname, $username) . ' &) > /dev/null';
  drush_log(dt("Forking : !cmd", array('!cmd' => $cmd)));
  system($cmd);
}