Skip to content

Commit

Permalink
Allow to ignore SIGINT (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault authored Apr 4, 2022
1 parent f3f21ee commit 68b59f3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions frontend/src/main/scala/bloop/Bloop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import java.io.File
import org.slf4j
import java.nio.file.attribute.PosixFilePermissions
import java.nio.file.Path
import sun.misc.{Signal, SignalHandler}

sealed abstract class Bloop

Expand Down Expand Up @@ -67,6 +68,9 @@ object Bloop {
)
}

if (java.lang.Boolean.getBoolean("bloop.ignore-sig-int"))
ignoreSigint()

lockFilesOrHostPort match {
case Left(hostPort) =>
startServer(Left(hostPort))
Expand All @@ -80,6 +84,16 @@ object Bloop {
}
}

private def ignoreSigint(): Unit = {
Signal.handle(
new Signal("INT"),
signal => {
System.err.println("Ignoring Ctrl+C interruption")
}
)
()
}

def startServer(socketPathsOrHostPort: Either[(InetAddress, Int), SocketPaths]): Unit = {
val socketAndPathOrHostPort = socketPathsOrHostPort.map { socketPaths =>
val socket = libdaemonjvm.Util.serverSocketFromChannel(
Expand Down

0 comments on commit 68b59f3

Please sign in to comment.