0

I type "sbt run", and compilation is ok, the server binds to the port, and then the process quietly terminates. How can I keep the process alive though? (I'm running an akka tcp server pulled straight from the akka docs -- should remain alive.)

Pseudocode:

object Main extends App {
    val ac = ActorSystem();
    val s = ac.actorOf(WebSocketManager.props());
}

Edit: The process stays alive after adding into build.sbt:

Compile / run / fork := true

Not sure what this does or if correct, but it works.

user2827214
  • 1,191
  • 1
  • 13
  • 32
  • 3
    Please provide some code sample – AminMal Jul 06 '22 at 10:10
  • Is your server waiting for a signal to be terminated? Does it wait for e.g. input stream to end with Ctrl+D? – Mateusz Kubuszok Jul 06 '22 at 12:32
  • My best guess as to what you pulled - https://github.com/akka/akka/blob/v2.6.19/akka-docs/src/test/scala/docs/io/EchoServer.scala - the main waits for keyboard input before telling the actorSystem to terminate. Assuming this is what you copied, try just not calling `system.terminate()` (or using some other trigger to terminate it) – Dylan Jul 06 '22 at 14:35
  • Updated the post! – user2827214 Jul 06 '22 at 19:30

0 Answers0