function drush_op_system

8.0.x drush_op_system($exec)
6.x drush_op_system($exec)
7.x drush_op_system($exec)
4.x drush_op_system($exec)
5.x drush_op_system($exec)
master 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.


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

Return value

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

See also


Related topics

5 calls to drush_op_system()
drush_core_exec_rsync in commands/core/
drush_sql_dump_execute in commands/sql/
Command callback. Outputs the entire Drupal database in SQL format using mysqldump.
drush_sql_sync in commands/sql/
_drush_sql_drop in commands/sql/
_drush_sql_query in commands/sql/
Execute a SQL query.


includes/, line 27
Functions for executing system commands. (e.g. exec(), system(), ...).


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

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

  return $result_code;