aboutsummaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
Diffstat (limited to 'tool')
-rw-r--r--tool/vcs.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 92ae46f443..50c0607039 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -21,10 +21,12 @@ if RUBY_VERSION < "2.0"
if defined?(fork)
def self.popen(command, *rest, &block)
- if Hash === (opts = rest[-1])
+ opts = rest.last
+ if opts.kind_of?(Hash)
dir = opts.delete(:chdir)
rest.pop if opts.empty?
end
+
if block
@orig_popen.call("-", *rest) do |f|
if f
@@ -46,10 +48,12 @@ if RUBY_VERSION < "2.0"
else
require 'shellwords'
def self.popen(command, *rest, &block)
- if Hash === (opts = rest[-1])
+ opts = rest.last
+ if opts.kind_of?(Hash)
dir = opts.delete(:chdir)
rest.pop if opts.empty?
end
+
command = command.shelljoin if Array === command
Dir.chdir(dir || ".") do
@orig_popen.call(command, *rest, &block)