Drush output terminates lines with CR/LF on linux, which is the WIndows convention; on linux lines should be terminated with LF.
This makes parsing output (e.g. with perl) more complex than it should be.

CommentFileSizeAuthor
#4 drush-939432.patch699 bytesjonhattan

Comments

kotnik’s picture

This is true, and it seems to be related to Console_Table PEAR class.

$ drushgit pm-list > ~/output.drush
$ file ~/output.drush
~/output.drush: ASCII text, with CRLF, LF line terminators

I'll check what's going on.

jonhattan’s picture

You're right kotnik. It's a problem upstream.

$ grep '\\r\\n' includes/table.inc 
        $return = implode("\r\n", $return);
            $return = $separator . "\r\n" . $return . "\r\n" . $separator;
        $return .= "\r\n";
            $return = $this->_getHeaderLine() .  "\r\n" . $return;
        return implode("\r\n", $return);

Please test attached patch.

I did think #877916: `drush help | less` doesn't work on Ubuntu 10.10+ (video inside) was a duplicate od this but drush help | less still doesn't work with this patch.

moshe weitzman’s picture

patch missing. replacing CRLF with LF seems reasonable.

jonhattan’s picture

StatusFileSize
new699 bytes

Patch here.

There's a special case this patch does not address within commands/core/watchdog.drush.inc where the table is hijacked for --tail implementation. Do you see drush wd-show --tail | less as a recurrent use case? I think watchdog is not feeding us with a ton of lines per second.

jonhattan’s picture

Status: Active » Needs review
moshe weitzman’s picture

Status: Needs review » Fixed

committed as is. thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.