Drush 6.x pipe issue

Drush is a great tool to manage Drupal.  However, the command syntax occasionally breaks between major versions.  For example, when I upgraded from Drush 5.9 to 6.2 I noticed my commands that included --pipe now provided output in json format by default (instead of the previous string default).  That broke a number of my scripts because they were expecting plain strings.  After some google searching I deduced I needed to add a --format=[something magical here] but even though https://github.com/drush-ops/drush/blob/master/tests/outputFormatUnitTest.php said --format=string should work, it didn't.  That parameter threw this error:

[error] The output data could not be processed by the selected format 'string'.  The command 'core-status' does not produce output in a structure usable by this output format.

Fortunately, the unit test mentioned above also listed --format=list which (at least in the unit test) appears to do the same thing (update: the output looks the same if result is a single line but arrays need list format and single line responses need string format, which is why json is the default format because it can handle both) and lo and behold it worked!  So anywhere you used to use (correction: some drush commands accept the --format parameter and some don't so try each original command first to see if it needs --format=list) 
drush [command] --pipe 
instead use 
drush [command] --format=list --pipe

P.S. Drush 6.2 also chokes on %dump and %dump-dir in your alias files.  I just removed them since I implemented my own sql-sync process since Drush's was so slow and buggy.


Post a Comment

Keep it clean and professional...