Skip to content

Commit

Permalink
sudo the rmdir on pkg uninstall
Browse files Browse the repository at this point in the history
fixes an issue we've hit where chmod 777 is insufficient to allow
Pathname#rmdir to work properly.

refs #1374
  • Loading branch information
phinze committed Nov 1, 2013
1 parent 2a5bb88 commit 02d1543
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/cask/pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def uninstall
_with_full_permissions(dir) do
_clean_broken_symlinks(dir)
_clean_ds_store(dir)
dir.rmdir if dir.children.empty?
_rmdir(dir)
end
end
end
Expand Down Expand Up @@ -55,6 +55,12 @@ def info
)
end

def _rmdir(path)
if path.children.empty?
@command.run!('rmdir', :args => [path], :sudo => true)
end
end

def _with_full_permissions(path, &block)
original_mode = (path.stat.mode % 01000).to_s(8)
@command.run!('chmod', :args => ['777', path], :sudo => true)
Expand Down

0 comments on commit 02d1543

Please sign in to comment.