title: How to exit a sbt task?
body: <p>I run a sbt task. Normal scenario after it finishes, it should stop in the terminal. But the terminal is not waiting for next input meaning : my task keeps running. I assume some called threads were not exited after the task launched them.</p>
  
  <p><strong>How to exit clean and kill all processes started by the sbt task ?</strong>
  I could debug which service was not stopped but it will take a long time to figure out.</p>
  
  <p>More details</p>
  
  <p>In the build.sbt</p>
  
  <pre><code>lazy val refreshTranslations = taskKey[Unit]("blabla")
  fullRunTask(refreshTranslations, Compile, "tasks.TranslationTask")
  </code></pre>
  
  <p>In the task</p>
  
  <pre><code>object TranslationTask {
  
    def main(args: Array[String]): Unit = {
      // background stuff with ActorSystem() , AhcWSClient()
      Await.result(service.get, 20.seconds)
      ...
    }
  }
  </code></pre>