aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMarkus Reiter2017-10-02 14:02:24 +0200
committerGitHub2017-10-02 14:02:24 +0200
commit23da0aa7fb91c68807e1278b2f858beefe5ea35a (patch)
treed2d7c82656a7cde586ad7dc7dc5d821e5f093a29 /Library/Homebrew
parente7cf509cfb5891ad32eebf8d2ec58bd936af6694 (diff)
parent3bb89f5440c030e06819affe3b821a771e86a671 (diff)
downloadbrew-23da0aa7fb91c68807e1278b2f858beefe5ea35a.tar.bz2
Merge pull request #3247 from reitermarkus/fix-trash
Fix `brew tests` leaving last file in trash.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb7
-rw-r--r--Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb2
2 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb
index badd549ce..d0b2eb6ef 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb
@@ -253,7 +253,7 @@ module Hbc
end
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
repeat with i from 1 to (count argv)
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 output to output & trashedItem
if i < count trashedItems then
- set output to output & (do shell script "printf \"\\0\"")
+ set output to output & character id 0
end if
end repeat
@@ -275,6 +275,9 @@ module Hbc
end tell
end run
EOS
+
+ # Remove AppleScript's automatic newline.
+ result.tap { |r| r.stdout.sub!(/\n$/, "") }
end
def uninstall_rmdir(*directories, command: nil, **_)
diff --git a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
index 06eec4a01..4fdab60d0 100644
--- a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
+++ b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
@@ -149,6 +149,8 @@ shared_examples "#uninstall_phase or #zap_phase" do
end
[:delete, :trash].each do |directive|
+ next if directive == :trash && ENV["HOMEBREW_TESTS_COVERAGE"].nil?
+
context "using :#{directive}" do
let(:dir) { TEST_TMPDIR }
let(:absolute_path) { Pathname.new("#{dir}/absolute_path") }