function drush_op_system

8.0.x exec.inc drush_op_system($exec)
6.x exec.inc drush_op_system($exec)
7.x exec.inc drush_op_system($exec)
4.x drush.inc drush_op_system($exec)
5.x exec.inc drush_op_system($exec)
master exec.inc drush_op_system($exec)

Calls 'system()' function, passing through all arguments unchanged.

This should be used when calling possibly mutative or destructive functions (e.g. unlink() and other file system functions) so that can be suppressed if the simulation mode is enabled.

Parameters

$exec: The shell command to execute. Parameters should already be escaped.

Return value

The result code from system(): 0 == success.

See also

drush_shell_exec()

Related topics

8 calls to drush_op_system()
drush_backend_fork in includes/backend.inc
A small utility function to call a drush command in the background.
drush_core_call_rsync in commands/core/rsync.core.inc
Make a direct call to rsync after the source and destination paths have been evaluated.
drush_core_cli in commands/core/core.drush.inc
drush_sql_dump_execute in commands/sql/sql.drush.inc
Command callback. Outputs the entire Drupal database in SQL format using mysqldump.
drush_sql_sync in commands/sql/sync.sql.inc

... See full list

File

includes/drush.inc, line 1234
The drush API implementation and helpers.

Code

function drush_op_system($exec) {
  if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
    drush_print("Calling system($exec);");
  }

  if (drush_get_context('DRUSH_SIMULATE')) {
    return 0;
  }

  // Throw away output.  Use drush_shell_exec() to capture output.
  system($exec, $result_code);

  return $result_code;
}