Fix for MacOS.

This commit is contained in:
cheatfate 2018-12-12 16:52:29 +02:00
parent 2ca85ab950
commit 39deeca600
1 changed files with 7 additions and 1 deletions

View File

@ -489,7 +489,13 @@ proc socketExists(filename: string): bool =
proc loggingHandler(api: DaemonAPI): Future[void] = proc loggingHandler(api: DaemonAPI): Future[void] =
var retFuture = newFuture[void]("logging.handler") var retFuture = newFuture[void]("logging.handler")
var loop = getGlobalDispatcher() var loop = getGlobalDispatcher()
let fd = wrapAsyncSocket(SocketHandle(api.process.outputHandle)) let pfd = SocketHandle(api.process.outputHandle)
var fd = AsyncFD(pfd)
if not setSocketBlocking(pfd, false):
discard close(cint(pfd))
raiseOsError(osLastError())
register(AsyncFD(pfd))
proc readOutputLoop(udata: pointer) {.gcsafe.} = proc readOutputLoop(udata: pointer) {.gcsafe.} =
var buffer: array[2048, char] var buffer: array[2048, char]
let res = posix.read(cint(fd), addr buffer[0], 2000) let res = posix.read(cint(fd), addr buffer[0], 2000)