diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-28 00:35:02 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-03-28 10:09:33 -0400 |
commit | 3232a1557aabd1ef3a59cbea38c883d4abb7ff32 (patch) | |
tree | 09ae92e35fe40b95143b0fb0291aff00f399bbc2 /examples/fork-example | |
parent | a3e5f304e99ff47165af6ed20182f06700e15b33 (diff) | |
download | cbt-3232a1557aabd1ef3a59cbea38c883d4abb7ff32.tar.gz cbt-3232a1557aabd1ef3a59cbea38c883d4abb7ff32.tar.bz2 cbt-3232a1557aabd1ef3a59cbea38c883d4abb7ff32.zip |
add support for forking the jvm process when invoking a main class
and add example of using akka-http that doesn’t work without this.
Also add functionality to emulate inheritIO when running via nailgun
process. Only caveat right now: user has to press ENTER to terminate
the input strea.
Diffstat (limited to 'examples/fork-example')
-rw-r--r-- | examples/fork-example/Main.scala | 29 | ||||
-rw-r--r-- | examples/fork-example/build/build.scala | 17 |
2 files changed, 46 insertions, 0 deletions
diff --git a/examples/fork-example/Main.scala b/examples/fork-example/Main.scala new file mode 100644 index 0000000..2ce5af8 --- /dev/null +++ b/examples/fork-example/Main.scala @@ -0,0 +1,29 @@ +package cbt_examples.fork_example + +import akka.http.scaladsl.server._ +import akka.http.scaladsl.model._ +import akka.http.scaladsl.server.Directives._ +import akka.http.scaladsl.settings._ + +object Service extends HttpApp with App { + // should all appear in separate lines + System.out.println("HelloHello") + System.err.println("HelloHello") + System.out.println("HelloHello") + System.err.println("HelloHello") + System.out.println("HelloHello") + System.err.println("HelloHello") + System.out.println("HelloHello") + System.err.println("HelloHello") + System.out.println("HelloHello") + System.err.println("HelloHello") + + override protected def route = + path("test") { + get { + complete(HttpResponse()) + } + } + + startServer("localhost", 8080) +} diff --git a/examples/fork-example/build/build.scala b/examples/fork-example/build/build.scala new file mode 100644 index 0000000..0f033ee --- /dev/null +++ b/examples/fork-example/build/build.scala @@ -0,0 +1,17 @@ +package cbt_examples_build.akka_example + +import cbt._ +import java.net.URL + +class Build(val context: Context) extends BaseBuild { + override def defaultScalaVersion = "2.12.1" + + override def fork = true + + override def dependencies = + super.dependencies ++ + Resolver(mavenCentral).bind( + ScalaDependency("com.typesafe.akka", "akka-http", "10.0.5") + ) + +} |