Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
0c22cc45
Commit
0c22cc45
authored
8 years ago
by
Kaito Udagawa
Browse files
Options
Downloads
Patches
Plain Diff
cask: Call Tempfile#close(true) with the choices file to ensure it deleted
parent
28072021
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/cask/lib/hbc/artifact/pkg.rb
+16
-8
16 additions, 8 deletions
Library/Homebrew/cask/lib/hbc/artifact/pkg.rb
Library/Homebrew/cask/test/cask/artifact/pkg_test.rb
+3
-1
3 additions, 1 deletion
Library/Homebrew/cask/test/cask/artifact/pkg_test.rb
with
19 additions
and
9 deletions
Library/Homebrew/cask/lib/hbc/artifact/pkg.rb
+
16
−
8
View file @
0c22cc45
...
...
@@ -54,17 +54,25 @@ module Hbc
]
args
<<
"-verboseR"
if
Hbc
.
verbose
args
<<
"-allowUntrusted"
if
pkg_install_opts
:allow_untrusted
if
pkg_install_opts
:choices
choices_file
=
choices_
xml
args
<<
"-applyChoiceChangesXML"
<<
choices_file
.
path
with_choices_file
pkg_install_opts
(
:choices
)
do
|
choices_path
|
args
<<
"-applyChoiceChangesXML"
<<
choices_path
if
choices_
path
@command
.
run!
(
"/usr/sbin/installer"
,
sudo:
true
,
args:
args
,
print_stdout:
true
)
end
@command
.
run!
(
"/usr/sbin/installer"
,
sudo:
true
,
args:
args
,
print_stdout:
true
)
end
def
choices_xml
file
=
Tempfile
.
open
([
""
,
".xml"
])
file
.
write
Plist
::
Emit
.
dump
(
pkg_install_opts
(
:choices
))
file
def
with_choices_file
(
choices
)
unless
choices
yield
nil
return
end
begin
file
=
Tempfile
.
new
([
"choices"
,
".xml"
])
file
.
write
Plist
::
Emit
.
dump
(
choices
)
yield
file
.
path
ensure
file
.
close
(
true
)
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/cask/test/cask/artifact/pkg_test.rb
+
3
−
1
View file @
0c22cc45
...
...
@@ -60,7 +60,9 @@ describe Hbc::Artifact::Pkg do
</plist>
EOS
file
.
stubs
path:
Pathname
.
new
(
"/tmp/choices.xml"
)
Tempfile
.
expects
(
:open
).
returns
(
file
)
file
.
expects
(
:close
).
with
true
Tempfile
.
expects
(
:new
).
returns
file
Hbc
::
FakeSystemCommand
.
expects_command
([
"/usr/bin/sudo"
,
"-E"
,
"--"
,
"/usr/sbin/installer"
,
"-pkg"
,
@cask
.
staged_path
.
join
(
"MyFancyPkg"
,
"Fancy.pkg"
),
"-target"
,
"/"
,
"-applyChoiceChangesXML"
,
@cask
.
staged_path
.
join
(
"/tmp/choices.xml"
)])
shutup
do
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment