Merge pull request #3247 from reitermarkus/fix-trash
Fix `brew tests` leaving last file in trash.
This commit is contained in:
commit
23da0aa7fb
@ -253,7 +253,7 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
def trash_paths(*paths, command: nil, **_)
|
def trash_paths(*paths, command: nil, **_)
|
||||||
command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths])
|
result = command.run!("/usr/bin/osascript", args: ["-e", <<-'EOS'.undent, *paths])
|
||||||
on run argv
|
on run argv
|
||||||
repeat with i from 1 to (count argv)
|
repeat with i from 1 to (count argv)
|
||||||
set item i of argv to (item i of argv as POSIX file)
|
set item i of argv to (item i of argv as POSIX file)
|
||||||
@ -267,7 +267,7 @@ module Hbc
|
|||||||
set trashedItem to POSIX path of (item i of trashedItems as string)
|
set trashedItem to POSIX path of (item i of trashedItems as string)
|
||||||
set output to output & trashedItem
|
set output to output & trashedItem
|
||||||
if i < count trashedItems then
|
if i < count trashedItems then
|
||||||
set output to output & (do shell script "printf \"\\0\"")
|
set output to output & character id 0
|
||||||
end if
|
end if
|
||||||
end repeat
|
end repeat
|
||||||
|
|
||||||
@ -275,6 +275,9 @@ module Hbc
|
|||||||
end tell
|
end tell
|
||||||
end run
|
end run
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
# Remove AppleScript's automatic newline.
|
||||||
|
result.tap { |r| r.stdout.sub!(/\n$/, "") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def uninstall_rmdir(*directories, command: nil, **_)
|
def uninstall_rmdir(*directories, command: nil, **_)
|
||||||
|
@ -149,6 +149,8 @@ shared_examples "#uninstall_phase or #zap_phase" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
[:delete, :trash].each do |directive|
|
[:delete, :trash].each do |directive|
|
||||||
|
next if directive == :trash && ENV["HOMEBREW_TESTS_COVERAGE"].nil?
|
||||||
|
|
||||||
context "using :#{directive}" do
|
context "using :#{directive}" do
|
||||||
let(:dir) { TEST_TMPDIR }
|
let(:dir) { TEST_TMPDIR }
|
||||||
let(:absolute_path) { Pathname.new("#{dir}/absolute_path") }
|
let(:absolute_path) { Pathname.new("#{dir}/absolute_path") }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user