curl - My Apache 2 error log contains all error message lines splitted to individual characters -


i mean, error messages splitted 1 character length, , these lines in error_log. example if error message of cgi application "error", can see 5 lines of text, 1 line every character of error message, appended referer , other time informations. error messages come forked curl process, , countains \r (carriage return) characters, because of downloading progress indicator. can error output / stderr of curl processes line-by-line?

fortunately managed find solution popen3 stdlib:

require "open3"  cmd=%q{curl -b cookie.txt 'http://www.example.com/file/afancyfileid/yetanotherfilename.avi' -l -o -j}  open3.popen3(cmd) {|stdin, stdout, stderr, wait_thr|   pid = wait_thr.pid # pid of started process.   line_no=0   stderr.each_char |c|         if c=="\r"          line_no+=1         stderr.puts if line_no % 5 == 0        else         stderr.print c if line_no % 5 == 0        end   end   exit_status = wait_thr.value  } 

i print every 5th lines not let grow error_log fast.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -