9
控制台之行git clone会有进度条显示百分比,如何实现,如何拿到其中的值
source link: http://quangelab.com/git-progress/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
控制台之行git clone会有进度条显示百分比,如何实现,如何拿到其中的值
for((i=1;i<=10;i++));do { sleep 1 ;echo -e "\r" $(expr $i \* 4) "\c";} done;
如何拿到输出的所有值
require 'open3'
def copy_lines(str_in, str_out)
str_in.each("\r") {|line| str_out.puts line}
end
Open3.popen3( 'cd && cd /Users/git/Desktop/tryImport && git clone --progress [email protected]:CSDN_Dev/labhub.git' ) do |stdin, stdout, stderr, t|
stdin.close
err_thr = Thread.new { copy_lines(stderr, $stderr) }
puts "Reading STDOUT"
copy_lines(stdout, $stdout)
err_thr.join
end
Written on August 22, 2016
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK