Quantcast
Channel: Admins Goodies » stderr
Viewing all articles
Browse latest Browse all 10

How can I capture output from LFTP? (Output not written to STDOUT or STDERR?)

$
0
0

Question

I would like get access to progress information from lftp. Currently, I’m using curl like so:

curl http://example.com/file -o file -L 2> download.log

This writes curl’s progress information to the download.log file, which I can tail to get real-time progress.

But the same approach doesn’t work with lftp, either with stdout or stderr. I end up with an empty download.log file, until the transfer is complete.

lftp -e 'get http://example.com/file;quit' 2> download.log
lftp -e 'get http://example.com/file;quit' 1> download.log

When I don’t redirect output, I see progress on the screen. When I do redirect output, I stop seeing progress on the screen, but nothing shows up in download.log. After the file transfer is complete, I see the final result, like this – but nothing before:

97618627 bytes transferred in 104 seconds (913.1K/s)

Is lftp doing something unusual with its output – printing to screen without printing to stdout/stderr? Are there other ways of capturing screen output than redirecting stdout/stderr?

Answer

It sounds to me like it’s buffering its output. You might try the unbuffer expect script (man page).


Viewing all articles
Browse latest Browse all 10

Trending Articles