From 6108a64973e74dd9c669ce1c024732c1db818e70 Mon Sep 17 00:00:00 2001 From: Benjamin Schaaf Date: Tue, 15 Jan 2019 21:32:36 +1100 Subject: [PATCH] Fix OSX compiler errors --- source/eventcore/drivers/posix/driver.d | 3 +- source/eventcore/drivers/posix/processes.d | 62 ++++++++++++++++++++-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/source/eventcore/drivers/posix/driver.d b/source/eventcore/drivers/posix/driver.d index 15b8abe..ef36e18 100644 --- a/source/eventcore/drivers/posix/driver.d +++ b/source/eventcore/drivers/posix/driver.d @@ -54,7 +54,8 @@ final class PosixEventDriver(Loop : PosixEventLoop) : EventDriver { version (linux) alias WatcherDriver = InotifyEventDriverWatchers!EventsDriver; //else version (OSX) alias WatcherDriver = FSEventsEventDriverWatchers!EventsDriver; else alias WatcherDriver = PollEventDriverWatchers!EventsDriver; - alias ProcessDriver = SignalEventDriverProcesses!Loop; + version (linux) alias ProcessDriver = SignalEventDriverProcesses!Loop; + else alias ProcessDriver = DummyEventDriverProcesses!Loop; Loop m_loop; CoreDriver m_core; diff --git a/source/eventcore/drivers/posix/processes.d b/source/eventcore/drivers/posix/processes.d index e70d7fc..a6955c6 100644 --- a/source/eventcore/drivers/posix/processes.d +++ b/source/eventcore/drivers/posix/processes.d @@ -6,19 +6,18 @@ import eventcore.drivers.posix.driver; import eventcore.drivers.posix.signals; import eventcore.internal.utils : nogc_assert, print; +import core.stdc.errno : errno, EAGAIN, EINPROGRESS; +import core.sys.posix.signal; +import core.sys.posix.unistd : close, read, write, dup; import std.algorithm.comparison : among; import std.variant : visit; -import core.stdc.errno : errno, EAGAIN, EINPROGRESS; -import core.sys.linux.sys.signalfd; -import core.sys.posix.signal; -import core.sys.posix.unistd : close, read, write, dup ; - private enum SIGCHLD = 17; final class SignalEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProcesses { @safe: /*@nogc:*/ nothrow: + import core.sys.linux.sys.signalfd; private { static struct ProcessInfo { @@ -290,3 +289,56 @@ final class SignalEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProce return info.userData.ptr; } } + +final class DummyEventDriverProcesses(Loop : PosixEventLoop) : EventDriverProcesses { +@safe: /*@nogc:*/ nothrow: + + this(Loop loop, EventDriverPipes pipes) {} + + void dispose() {} + + override ProcessID adopt(int system_pid) + { + assert(false, "TODO!"); + } + + override Process spawn(string[] args, ProcessStdinFile stdin, ProcessStdoutFile stdout, ProcessStderrFile stderr, const string[string] env, ProcessConfig config, string working_dir) + { + assert(false, "TODO!"); + } + + override bool hasExited(ProcessID pid) + { + assert(false, "TODO!"); + } + + override void kill(ProcessID pid, int signal) + { + assert(false, "TODO!"); + } + + override size_t wait(ProcessID pid, ProcessWaitCallback on_process_exit) + { + assert(false, "TODO!"); + } + + override void cancelWait(ProcessID pid, size_t waitId) + { + assert(false, "TODO!"); + } + + override void addRef(ProcessID pid) + { + assert(false, "TODO!"); + } + + override bool releaseRef(ProcessID pid) + { + assert(false, "TODO!"); + } + + protected override void* rawUserData(ProcessID descriptor, size_t size, DataInitializer initialize, DataInitializer destroy) + @system { + assert(false, "TODO!"); + } +}