[main] Report Done or Interrupted on exit

This commit is contained in:
Paul Campbell 2019-04-29 20:28:02 +01:00
parent a79c3320a5
commit 73f4a79254

View file

@ -1,11 +1,18 @@
package net.kemitix.s3thorp package net.kemitix.s3thorp
import cats.effect.ExitCase.Canceled
import cats.effect.{ExitCode, IO, IOApp} import cats.effect.{ExitCode, IO, IOApp}
import cats.syntax.all._ import cats.syntax.all._
object Main extends IOApp { object Main extends IOApp {
override def run(args: List[String]): IO[ExitCode] = def exec(args: List[String]): IO[ExitCode] =
IO(println("S3Thorp - hashed sync for s3")).as(ExitCode.Success) IO(println("S3Thorp - hashed sync for s3")).as(ExitCode.Success)
override def run(args: List[String]): IO[ExitCode] =
exec(args).guaranteeCase {
case Canceled => IO(println("Interrupted"))
case _ => IO(println("Done"))
}
} }