Skip to content

Commit

Permalink
fix unintended interruption of json download
Browse files Browse the repository at this point in the history
fixes #5
  • Loading branch information
memo33 committed Nov 17, 2024
1 parent b5d0318 commit 7006d2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]
### Fixed
- an issue affecting some old terminals in which the escape sequences used for displaying progress bars were incorrectly printed to the console (#8)
- an issue that could cause warning messages to mess up the prompt display (#5)

### Changed
- improved error message if channel-build fails randomly in case old files could not be removed (#6)
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/sc4pac/Find.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ object Find {
def packageData[A <: JD.Package | JD.Asset : Reader](module: C.Module, version: String): RIO[ResolutionContext, Option[A]] = {
def tryAllRepos(repos: Seq[MetadataRepository], context: ResolutionContext): Task[Option[A]] = ZIO.collectFirst(repos) { repo =>
val task: Task[Option[A]] = {
repo.fetchModuleJson[A](module, version, context.cache.fetchText).map(Some(_))
repo.fetchModuleJson[A](module, version, context.cache.fetchText)
.uninterruptible // uninterruptile to avoid incomplete-download error messages when resolving is interrupted to prompt for a variant selection (downloading json should be fairly quick anyway)
.map(Some(_))
.catchSome {
case _: error.Sc4pacVersionNotFound => ZIO.succeed(None) // repositories not containing module:version can be ignored
case e: (ArtifactError.WrongChecksum | ArtifactError.ChecksumFormatError | ArtifactError.ChecksumNotFound) =>
Expand Down

0 comments on commit 7006d2d

Please sign in to comment.