function drush_shell_proc_open
8.0.x exec.inc | drush_shell_proc_open($cmd) |
6.x exec.inc | drush_shell_proc_open($cmd) |
7.x exec.inc | drush_shell_proc_open($cmd) |
5.x exec.inc | drush_shell_proc_open($cmd) |
master exec.inc | drush_shell_proc_open($cmd) |
Execute bash command using proc_open().
@returns Exit code from launched application 0 no error 1 general error 127 command not found
Related topics
6 calls to drush_shell_proc_open()
- drush_core_execute in commands/
core/ core.drush.inc - Command callback. Execute specified shell code. Often used by shell aliases that start with !.
- drush_sql_cli in commands/
sql/ sql.drush.inc - drush_ssh_site_ssh in commands/
core/ ssh.drush.inc - Command callback.
- _drush_backend_invoke in includes/
backend.inc - Create a new pipe with proc_open, and attempt to parse the output.
- _drush_core_execute_cmd in commands/
core/ core.drush.inc - Helper function for drush_core_execute: run one shell command
File
- includes/
exec.inc, line 240 - Functions for executing system commands. (e.g. exec(), system(), ...).
Code
function drush_shell_proc_open($cmd) {
if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
drush_print("Calling proc_open($cmd);", 0, STDERR);
}
if (!drush_get_context('DRUSH_SIMULATE')) {
$process = proc_open($cmd, array(0 => STDIN, 1 => STDOUT, 2 => STDERR), $pipes);
$proc_status = proc_get_status($process);
$exit_code = proc_close($process);
return ($proc_status["running"] ? $exit_code : $proc_status["exitcode"]);
}
return 0;
}