Merge pull request #3837 from eed3si9n/wip/windows2

Add Library interface
This commit is contained in:
eugene yokota 2017-12-22 16:56:03 -05:00 committed by GitHub
commit a28381e93a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -20,4 +20,4 @@ install:
- SET PATH=C:\sbt\sbt\bin;%PATH%
- SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8
test_script:
- sbt "scripted actions/*"
- sbt "scripted actions/* server/*"

View File

@ -29,7 +29,7 @@ import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.W32APIOptions;
public interface NGWin32NamedPipeLibrary extends WinNT {
public interface NGWin32NamedPipeLibrary extends Library, WinNT {
int PIPE_ACCESS_DUPLEX = 3;
int PIPE_UNLIMITED_INSTANCES = 255;
int FILE_FLAG_FIRST_PIPE_INSTANCE = 524288;

View File

@ -26,7 +26,7 @@ import sjsonnew.JsonFormat
import sjsonnew.shaded.scalajson.ast.unsafe._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.util.{ Success, Failure }
import scala.util.{ Success, Failure, Try }
import sbt.io.syntax._
import sbt.io.{ Hash, IO }
import sbt.internal.server._
@ -150,7 +150,10 @@ private[sbt] final class CommandExchange {
socketfile,
pipeName)
val x = Server.start(connection, onIncomingSocket, s.log)
Await.ready(x.ready, Duration("10s"))
// don't throw exception when it times out
val d = "10s"
Try(Await.ready(x.ready, Duration(d)))
x.ready.value match {
case Some(Success(_)) =>
// rememeber to shutdown only when the server comes up
@ -164,7 +167,10 @@ private[sbt] final class CommandExchange {
case Some(Failure(e)) =>
s.log.error(e.toString)
server = None
case None => // this won't happen because we awaited
case None =>
s.log.warn(s"sbt server could not start in $d")
server = None
firstInstance.set(false)
}
}
s