Feature #306 » 0001-moves-shellout-method-to-Utils-Shell.patch
| lib/redmine/scm/adapters/abstract_adapter.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
begin
|
||
|
mode = "r+"
|
||
|
IO.popen(cmd, mode) do |io|
|
||
|
io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding)
|
||
|
io.close_write unless options[:write_stdin]
|
||
|
block.call(io) if block_given?
|
||
|
end
|
||
|
Redmine::Utils::Shell.shellout(cmd, options, &block)
|
||
|
## If scm command does not exist,
|
||
|
## Linux JRuby 1.6.2 (ruby-1.8.7-p330) raises java.io.IOException
|
||
|
## in production environment.
|
||
| lib/redmine/utils.rb | ||
|---|---|---|
|
shell_quote(command)
|
||
|
end
|
||
|
end
|
||
|
# Executes the given command through IO.popen and yields an IO object
|
||
|
# representing STDIN / STDOUT
|
||
|
#
|
||
|
# Due to how popen works the command will be executed directly without
|
||
|
# involving the shell if cmd is an array.
|
||
|
def shellout(cmd, options = {}, &block)
|
||
|
mode = "r+"
|
||
|
IO.popen(cmd, mode) do |io|
|
||
|
io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding)
|
||
|
io.close_write unless options[:write_stdin]
|
||
|
block.call(io) if block_given?
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
module DateCalculation
|
||