cask/quarantine: sudo correctly during tests.

Use `NeverSudoSystemCommand` and pass it through to
`Quarantine.copy_xattrs` so `brew tests` doesn't try to `sudo`.

Fixes #15958

Co-authored-by: Bo Anderson <mail@boanderson.me>
Co-authored-by: Kevin <apainintheneck@gmail.com>
This commit is contained in:
Mike McQuaid 2023-09-06 10:03:45 -04:00
parent 43295b2637
commit 58df7885e6
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
2 changed files with 4 additions and 4 deletions

View File

@ -91,7 +91,7 @@ module Cask
command.run!("/bin/cp", args: ["-pR", *source.children, target],
sudo: true)
end
Quarantine.copy_xattrs(source, target)
Quarantine.copy_xattrs(source, target, command: command)
source.rmtree
elsif target.dirname.writable?
FileUtils.move(source, target)

View File

@ -174,11 +174,11 @@ module Cask
raise CaskQuarantinePropagationError.new(to, quarantiner.stderr)
end
sig { params(from: Pathname, to: Pathname).void }
def self.copy_xattrs(from, to)
sig { params(from: Pathname, to: Pathname, command: T.class_of(SystemCommand)).void }
def self.copy_xattrs(from, to, command:)
odebug "Copying xattrs from #{from} to #{to}"
system_command!(
command.run!(
swift,
args: [
*swift_target_args,