cask: fix writability check backing up an artifact
This commit is contained in:
parent
3e257890da
commit
3d16112b14
@ -114,7 +114,7 @@ module Cask
|
||||
source.dirname.mkpath
|
||||
|
||||
# We need to preserve extended attributes between copies.
|
||||
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !target.parent.writable?)
|
||||
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !source.parent.writable?)
|
||||
|
||||
delete(target, force: force, command: command, **options)
|
||||
end
|
||||
|
||||
@ -263,6 +263,11 @@ describe Cask::Artifact::App, :cask do
|
||||
end
|
||||
|
||||
describe "uninstall_phase" do
|
||||
after do
|
||||
FileUtils.chmod 0755, target_path if target_path.exist?
|
||||
FileUtils.chmod 0755, source_path if source_path.exist?
|
||||
end
|
||||
|
||||
it "deletes managed apps" do
|
||||
install_phase
|
||||
|
||||
@ -272,6 +277,16 @@ describe Cask::Artifact::App, :cask do
|
||||
|
||||
expect(target_path).not_to exist
|
||||
end
|
||||
|
||||
it "backs up read-only managed apps" do
|
||||
install_phase
|
||||
|
||||
FileUtils.chmod 0544, target_path
|
||||
|
||||
expect { uninstall_phase }.to raise_error(Errno::ENOTEMPTY)
|
||||
|
||||
expect(source_path).to be_a_directory
|
||||
end
|
||||
end
|
||||
|
||||
describe "summary" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user