lib/em-fs/fs/command.rb in em-fs-0.1.0 vs lib/em-fs/fs/command.rb in em-fs-0.1.1
- old
+ new
@@ -1,19 +1,19 @@
# -*- coding: utf-8 -*-
module EventMachine
class FS
class Command < EM::SystemCommand
- PROGRESS_REGEXP = /([A-Za-z0-9\.\-\/]+)\n[ ]+(\d+)/.freeze
+ PROGRESS_REGEXP = /([A-Za-z0-9\.,\-\/]+)\n[ ]+([^ ]+)/.freeze
##
# Invokes `#execute` of super-class and adds a progress matcher.
def execute &block
super &block
stdout.match PROGRESS_REGEXP, match: :last, in: :output do |file, bytes|
- receive_progress file, bytes.to_i
+ receive_progress file, bytes.gsub(/[^\d]/,'').to_i
end
self
end
@@ -46,13 +46,9 @@
#
# @return [Array] The array of callbacks for progress events.
private
def progress_callbacks
@progress_callbacks ||= []
- end
-
- def progress_regexp
- @progress_regexp ||= /([A-Za-z0-9\.\-\/]+)\n[ ]+(\d+)/.freeze
end
end
end
end