Fix Dmg
being detected as Tar
.
This commit is contained in:
parent
16d477c696
commit
67d51ef0e1
@ -106,11 +106,8 @@ module UnpackStrategy
|
||||
end
|
||||
|
||||
def self.can_extract?(path)
|
||||
imageinfo = system_command("hdiutil",
|
||||
args: ["imageinfo", path],
|
||||
print_stderr: false).stdout
|
||||
|
||||
!imageinfo.empty?
|
||||
stdout, _, status = system_command("hdiutil", args: ["imageinfo", path], print_stderr: false)
|
||||
status.success? && !stdout.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -22,9 +22,8 @@ module UnpackStrategy
|
||||
return false unless [Bzip2, Gzip, Lzip, Xz].any? { |s| s.can_extract?(path) }
|
||||
|
||||
# Check if `tar` can list the contents, then it can also extract it.
|
||||
IO.popen(["tar", "tf", path], err: File::NULL) do |stdout|
|
||||
!stdout.read(1).nil?
|
||||
end
|
||||
stdout, _, status = system_command("tar", args: ["tf", path], print_stderr: false)
|
||||
status.success? && !stdout.empty?
|
||||
end
|
||||
|
||||
private
|
||||
|
Loading…
x
Reference in New Issue
Block a user