Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Commit

Permalink
Quote paths before opening apps
Browse files Browse the repository at this point in the history
  • Loading branch information
s-mage committed Jan 2, 2016
1 parent 3e5b18c commit 3a016ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/rush/commands.rb
Expand Up @@ -69,7 +69,7 @@ def output_of(app, *args)
def open_command(app, *args)
opts = args.last.is_a?(Hash) ? args.pop : {}
env = opts[:env]
names = dir? ? '' : entries.map(&:to_s).join(' ')
names = dir? ? '' : entries.map { |x| Rush.quote x.to_s }.join(' ')
options = opts.reject { |k, _| k == :env }.map do |k, v|
key = k.size == 1 ? "-#{k}" : "--#{k}"
case
Expand All @@ -78,7 +78,8 @@ def open_command(app, *args)
else "#{key} #{v}"
end
end.join(' ')
cmd = "cd #{dirname}; #{app} #{names} #{options} #{args.join(' ')}"
dir = Rush.quote dirname.to_s
cmd = "cd #{dir}; #{app} #{names} #{options} #{args.join(' ')}"
if vars = opts[:env]
env = vars.inject({}) { |r, (k, v)| r.merge(k.to_s.upcase => v.to_s) }
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rush/entry.rb
Expand Up @@ -39,7 +39,7 @@ def self.factory(full_path, box=nil)

def to_s # :nodoc:
if box.host == 'localhost'
"#{full_path}"
full_path
else
inspect
end
Expand All @@ -59,7 +59,7 @@ def parent
end

def full_path
"#{@path}/#{@name}"
"#{path}/#{name}"
end

def quoted_path
Expand Down

0 comments on commit 3a016ea

Please sign in to comment.