Hey Drushies - I have some particular code that kills drush and I would like to throw a conditional in there to not to run that code when Drush is executing the bootstrap. Is there a global or something I can check to make sure it's not Drush running?

Files: 

Comments

msonnabaum’s picture

Status:Active» Fixed
<?php
if (!function_exists('drush_verify_cli')) {
 
// do stuff.
}
?>
greg.1.anderson’s picture

Component:Miscellaneous» Documentation
Category:support» task
Status:Fixed» Needs work

Okay, this is perhaps the most picky re-open ever. :)

I was thinking that whatever function we recommend here should be guaranteed to never change, regardless of drush version, and furthermore, we should document the function as being the sanctioned function to check for in modules.

I think that drush_verify_cli is a pretty good choice, but I slightly prefer drush_main. Either way, it just needs a comment in drush.php to advertise the policy.

R.J. Steinert’s picture

Awesome! Thanks guys :).

greg.1.anderson’s picture

Status:Needs work» Needs review
StatusFileSize
new450 bytes

Here is a comment that recommends using drush_main.

msonnabaum’s picture

Status:Needs review» Reviewed & tested by the community

That's fine with me. I just suggested drush_verify_cli because I saw features module was already using it, but drush_main is probably less likely to change.

moshe weitzman’s picture

Status:Reviewed & tested by the community» Fixed

Committed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.