Skip to content

Commit

Permalink
CHEF-1984: chdir to :cwd arg before running a command
Browse files Browse the repository at this point in the history
  • Loading branch information
renchap committed Jan 19, 2011
1 parent 52b99db commit 163604f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chef/lib/chef/shell_out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ def set_umask
File.umask(umask) if umask
end

def set_cwd
Dir.chdir(cwd) if cwd
end

def initialize_ipc
@stdout_pipe, @stderr_pipe, @process_status_pipe = IO.pipe, IO.pipe, IO.pipe
@process_status_pipe.last.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
Expand Down Expand Up @@ -381,6 +385,7 @@ def fork_subprocess
set_group
set_environment
set_umask
set_cwd

begin
command.kind_of?(Array) ? exec(*command) : exec(command)
Expand Down

0 comments on commit 163604f

Please sign in to comment.