_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
Comment #1
greg.1.anderson commentedYes, 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?
Comment #2
greg.1.anderson commentedComment #3
anarcat commentedshould we simply move this conversation to #1982502: Reduce complexity of backend invoke; consider removing concurrency?
Comment #4
greg.1.anderson commentedSee also https://github.com/drush-ops/drush/issues/1270