Skip to content

Commit

Permalink
Merge pull request #2 from lainor/patch-1
Browse files Browse the repository at this point in the history
Made possible to use `` in commands
  • Loading branch information
wijet committed Feb 22, 2012
2 parents 0f2a478 + 57b8d7c commit 2c41300
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/chef-sudo.rb
Expand Up @@ -72,11 +72,12 @@ def action_execute
command << "-u #{@new_resource.user}" if @new_resource.user
command << "-g #{@new_resource.group}" if @new_resource.group
command << "-i" if @new_resource.simulate_initial_login


# changed " to ' to support `command`
if @new_resource.cwd
command << %Q{ bash -c "cd #{@new_resource.cwd} && #{@new_resource.command}"}
command << %Q{ bash -c 'cd #{@new_resource.cwd} && #{@new_resource.command}'}
else
command << %Q{ bash -c "#{@new_resource.command}"}
command << %Q{ bash -c '#{@new_resource.command}'}
end

options = {:command => command.join(' ')}
Expand Down

0 comments on commit 2c41300

Please sign in to comment.