Skip to content

Commit 1f1e14f

Browse files
committed
Propagate exceptions from fiber
1 parent 9be8263 commit 1f1e14f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/fetch-player-dependencies.cr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ end
7878
tmp_dir_path = "#{Dir.tempdir}/invidious-videojs-dep-install"
7979
Dir.mkdir(tmp_dir_path) if !Dir.exists? tmp_dir_path
8080

81-
channel = Channel(String).new
81+
channel = Channel(String | Exception).new
8282

8383
dependencies_to_install.each do |dep|
8484
spawn do
@@ -99,7 +99,7 @@ dependencies_to_install.each do |dep|
9999

100100
# Unless we install an external dependency, crystal provides no way of extracting a tarball.
101101
# Thus we'll go ahead and call a system command.
102-
`tar -zxf '#{download_path}/package.tgz' -C '#{download_path}'"`
102+
`tar -vzxf '#{download_path}/package.tgz' -C '#{download_path}'`
103103
raise "Extraction for #{dep} failed" if !$?.success?
104104

105105
# Would use File.rename in the following steps but for some reason it just doesn't work here.
@@ -140,6 +140,8 @@ dependencies_to_install.each do |dep|
140140
end
141141

142142
channel.send(dep_name)
143+
rescue ex
144+
channel.send(ex)
143145
end
144146
end
145147

@@ -149,6 +151,11 @@ else
149151
puts "#{"Resolving".colorize(:green)} #{"player".colorize(:blue)} dependencies"
150152
dependencies_to_install.size.times do
151153
result = channel.receive
154+
155+
if result.is_a? Exception
156+
raise result
157+
end
158+
152159
puts "#{"Fetched".colorize(:green)} #{result.colorize(:blue)}"
153160
end
154161
end

0 commit comments

Comments
 (0)