SvnRunner: add --non-interactive when not interactive

This commit is contained in:
Josh Holtrop 2018-02-12 21:35:38 -05:00
parent 94c38ade8f
commit 957f7ec0fd

View File

@ -16,6 +16,8 @@ module Svi
# Optional arguments. # Optional arguments.
# @option options [Array<String>] :global_args # @option options [Array<String>] :global_args
# Global svn arguments to place before the subcommand. # Global svn arguments to place before the subcommand.
# @option options [Boolean] :allow_interactive
# Allow interaction with svn command.
# #
# @yield [line] # @yield [line]
# If a block is given, each line that the Subversion command writes to # If a block is given, each line that the Subversion command writes to
@ -27,9 +29,11 @@ module Svi
# @raise [SvnExecError] # @raise [SvnExecError]
# If the svn command errors out this exception is raised. # If the svn command errors out this exception is raised.
def run_svn(subcommand, args, options = {}, &block) def run_svn(subcommand, args, options = {}, &block)
options[:global_args] ||= []
options[:global_args] << "--non-interactive" unless options[:allow_interactive]
command = [ command = [
"svn", "svn",
*(options[:global_args] || []), *options[:global_args],
subcommand, subcommand,
*args, *args,
].compact ].compact