When running in FreeBSD, drush generates an error because the script tries to launch php-cli when it doesn't exist. This problem occurs because drush relies on `bash` behaviour, but it calls its shell as #!/bin/sh.

To be clear: drush *is* a Bourne shell script, but it depends on behaviour that works in Bash's implementation of Bourne shell in the way it determines the location of the PHP binary it will use.

The problem was described in http://drupal.org/node/1916326 but the two workarounds offered there were (1) to force an unnecessary dependency on bash, and (2) to avoid the problematic code by statically configuring $DRUSH_PHP prior to running drush. While these are reasonable as workarounds, neither of them is a solution to the core problem.

The attached patch fixes this problem in FreeBSD, and also works in Linux and OSX machines I tested it on.

drush-7.x-5.x-freebsd.patch813 bytesghoti
Members fund testing for the Drupal project. Drupal Association Learn more


ghoti’s picture

Component: Core Commands » Config
greg.1.anderson’s picture

Status: Needs review » Fixed

Nice. Committed to 8.x-6.x and 7.x-5.x.

greg.1.anderson’s picture

This broke MinGW on Windows. Please see follow up at #1948584: Drush 6.0-dev does not work in MINGW32 on Windows 7. If the committed change breaks on FreeBSD, plrease re-open that issue.

Status: Fixed » Closed (fixed)

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