SvnRunner.run_svn should be a class method

This commit is contained in:
Josh Holtrop 2018-02-12 21:22:26 -05:00
parent 50529580c0
commit 94c38ade8f

View File

@ -4,6 +4,8 @@ module Svi
# Exception class to indicate an error with executing svn. # Exception class to indicate an error with executing svn.
class SvnExecError < RuntimeError; end class SvnExecError < RuntimeError; end
class << self
# Run Subversion and yield results linewise. # Run Subversion and yield results linewise.
# #
# @param subcommand [String, nil] # @param subcommand [String, nil]
@ -54,12 +56,12 @@ module Svi
stdout_yield = "" stdout_yield = ""
loop do loop do
so = stdout_rd.read_nonblock(exception: false) so = stdout_rd.read_nonblock(100000, exception: false)
if so.is_a?(String) if so.is_a?(String)
stdout += so stdout += so
stdout_yield += so stdout_yield += so
end end
se = stderr_rd.read_nonblock(exception: false) se = stderr_rd.read_nonblock(100000, exception: false)
if se.is_a?(String) if se.is_a?(String)
stderr += se stderr += se
end end
@ -88,4 +90,6 @@ module Svi
end end
end end
end
end end