0

I am trying to integrate ElasticSearch with Drupal and till now everything seems to be working except that the command drush sapi-i crashes with the output:

> 'C:/xampp/htdocs/my-project/docroot/vendor/bin/drush' is not recognized as an internal or external command,
> operable program or batch file.

In ProcessBase.php line 172:

  Output is empty.


search-api:index [--limit [LIMIT]] [--batch-size [BATCH-SIZE]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command> [<indexId>]

After debugging with drush sapi-i -d it seems the call to drush_backend_batch_process() causes the issue for some reason.

0

After checking the vendor/bin directory I noticed that the drush script exists but drush.bat or drush.cmd were missing, I mean, for some reason even though I executed the drush sapi-i command using Git-bash, Drupal was still trying to access the Windows type of the file (which didn't exist in the source I copied from Mac). so creating the below file manually fixed the issue.

drush.cmd file:

@echo off
setlocal DISABLEDELAYEDEXPANSION
php "%~dp0../drush/drush/drush" %*

drush file:

#!/usr/bin/env sh

dir=$(cd "${0%[/\\]*}" > /dev/null; cd '../drush/drush' && pwd)

if [ -d /proc/cygdrive ]; then
    case $(which php) in
        $(readlink -n /proc/cygdrive)/*)
            # We are in Cygwin using Windows php, so the path must be translated
            dir=$(cygpath -m "$dir");
            ;;
    esac
fi

"${dir}/drush" "$@"

Note that the drush script's line ending should be LF (instead of CRLF which drush.cmd needs), so in Git-bash simply cd to where your script is and run sed -i 's/\r$//' my-script-filename (if your editor can only save with CRLF).

| improve this answer | |
  • 1
    If this is the answer please accept it, thanks. – Alfred Armstrong Mar 3 at 15:18
  • The site doesn't allow yet, but sure ;-) – Top-Master Mar 4 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.