From 73f4a7925470d560923d84d1a3fd2dd7b7ba9c98 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 29 Apr 2019 20:28:02 +0100 Subject: [PATCH] [main] Report Done or Interrupted on exit --- src/main/scala/net/kemitix/s3thorp/Main.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/scala/net/kemitix/s3thorp/Main.scala b/src/main/scala/net/kemitix/s3thorp/Main.scala index 05b83eb..9e7896c 100644 --- a/src/main/scala/net/kemitix/s3thorp/Main.scala +++ b/src/main/scala/net/kemitix/s3thorp/Main.scala @@ -1,11 +1,18 @@ package net.kemitix.s3thorp +import cats.effect.ExitCase.Canceled import cats.effect.{ExitCode, IO, IOApp} import cats.syntax.all._ 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) + override def run(args: List[String]): IO[ExitCode] = + exec(args).guaranteeCase { + case Canceled => IO(println("Interrupted")) + case _ => IO(println("Done")) + } + }