Download & Extend

Improve Drush's handling of STDERR in backend invoke

Project:Drush
Component:Base system (internal API)
Category:feature request
Priority:major
Assigned:Unassigned
Status:active

Issue Summary

_drush_backend_generate_command() redirects STDERR to STDOUT when calling the remote drush command over ssh. This has the undesirable effect of making it almost impossible to parse the returned output from a script.

In particular, I'm making use of the --pipe switch on the user commands, but I find myself having to do all sorts of cleanup on the output before I can parse the comma separated string. Using the -q switch helps a little, but I have been caught a couple of times by failed writes to the cache file and other things that while helpful to know about, don't belong in the output.

I suggest an alias option to be able to suppress STDERR altogether, or maybe an option to specify a location to write STDERR to. This way, one could specify /dev/null or an actual log file.

Comments

#1

Priority:normal» major

Yes, Drush's handling of stderr does cause some problems. It should be improved at some point, but it is a more difficult job than simply adding a flag to redirect it, as the handling of i/o streams in backend invoke is closely coupled with the logging mechanism, etc.

c.f. #1719436: Not all commands using an @alias working?

#2

Title:Option to suppress STDERR rather than redirect it to STDOUT» Improve Drush's handling of STDERR in backend invoke
nobody click here