Drush CLI support 'Failed to parse output'

Been happy to use PHPstorm 2018 and my remote ubuntu apache server in Parallels to debug browser issues.

Use drush in a CLI on my OSX machine happily. Now that I'm attempting to use PHPStorm 2018 to run/debug phpunit tests, My drush commands are now intercepted by PHPStorm 2018. OK. so looking online I'm to add drush as resource under Setttings>Tools > Command Line Tool Support.

After I do so, and point to the binary that's set up as a global on my OSX user directory, PHPStorm 2018 is apparently trying to run an actual command and returns an error: "Failed To Add Tool".

Problem
Failed to parse output.
Command
/Users/sam/.composer/vendor/bin/drush help --format=json
Output
/Users/sam/.composer/vendor/bin/drush help --format=json
[error] The help command requires that a command name be provided. Run `drush list` to see a list of available commands.

Hmm. How to separate out running PHP commands in the CLI without PHPStorm 2018 getting in the way?

Most importantly, why run this command on setup? I can see pointing to the binary for future commands but on initial setup? On a copy of drush in my Parallels machine, the command drush help returns as expected. Now drush help --format=json returns 

array_key_exists() expects parameter 2 to be array, null given

I searched but could not find similar issue where it was resolved, sam

7 comments
Avatar
Vladimir Luchansky
Comment actions Permalink

Hello,

Command line tool support gathers the list of commands from CLI tools and then provides you an easy way to run them.

There's Preferences | Tools | External Tools that provides simple execution of the tool.

What is the drush version that you use?

0
Comment actions Permalink

Yes, thank you.

Drush Commandline Tool 9.2.1

 

0
Comment actions Permalink

We no longer support Drush as a Command Line Tool: https://youtrack.jetbrains.com/issue/WI-19420#comment=27-617046

My drush commands are now intercepted by PHPStorm 2018

Please clarify what it means. Does a debugging session start for Drush? If so, please disable the following entries at Preferences | Languages & Frameworks | PHP | Debug | Xdebug:

  • Break at first line in PHP Scripts
  • Force break at first line when no path mapping selected
  • Force break at first line when a script is outside the project
0
Comment actions Permalink

Thank you. Your most-recent link is helpful, but it's dated 2013? Then why is it still available in PHPStorm 2018?

Disabling these three options and attempting to run drush on the command line brings PHPStorm 2018.2 to the forefront "Incoming Conncection from Xdebug" and shows both PHPStorm projects to choose from. I keep ensuring that my preferences/settings are local to the project but it keeps happening. 

When PHPStorm says "path mapping" I think it means that in some configuration it's wanting to know the root of my Drupal project. Since I've never enabled Drush as a CLI tool I'm stumped why this keeps happening?, sam

0
Comment actions Permalink

I'd really like to be able to run drush on my command line again. At this point, going through all the myriad options of preferences/settings (never able to point to drush in PHPStorm 2018) it seems I have to shut down PHPStorm 2018 to run drush commands. Given that I've done as you suggested, what else could be intercepting my CLI from PHPStorm and how to get it to stop?

When I run drush on my CLI I get the "Incoming Xdebug Connection" dialog and in the file path dialog it's listing the path to where my drush is

/Users/sam/.composer/global/drush/drush/vendor/drush/drush/drush

And then a minute later another dialog "Incoming Xdebug Connection" with the file path /stdin

And it's showing me all the PHPStorm projects I have open. I'd like to learn how to not have to deal with that since I invoke it from the project's root.

0
Avatar
Vladimir Luchansky
Comment actions Permalink

Looks like it attempts to start a debugging session indeed.

What happens if you will stop PhpStorm from listening for incoming debugger connections via Run | Stop Listening for PHP Debug Connections or via phone button in the toolbar?

0
Comment actions Permalink

Thank you, it is set because I'm using it for debugging from the Parallels server. Turning it off for the times I need to use drush is more acceptable than shutting down PHPStorm to run the same. 

Drush seems to be affected in that it cannot find its modules and tools but that is outside the scope of PHPStorm. I believe the resolution of this ticket is "you can't use drush within PHPStorm 2018." Would that be accurate? Thx, sam

0

Please sign in to leave a comment.