Commit 4d8a8e65df

Vexu <15308111+Vexu@users.noreply.github.com>
2019-11-27 09:17:37
add more workarounds
1 parent 0d55075
Changed files (4)
lib
std
event
src-self-hosted
lib/std/event/fs.zig
@@ -1293,7 +1293,7 @@ pub fn Watch(comptime V: type) type {
                     os.linux.EINVAL => unreachable,
                     os.linux.EFAULT => unreachable,
                     os.linux.EAGAIN => {
-                        global_event_loop.linuxWaitFd(self.os_data.inotify_fd, os.linux.EPOLLET | os.linux.EPOLLIN);
+                        global_event_loop.linuxWaitFd(self.os_data.inotify_fd, os.linux.EPOLLET | os.linux.EPOLLIN | os.EPOLLONESHOT);
                     },
                     else => unreachable,
                 }
src-self-hosted/compilation.zig
@@ -363,7 +363,11 @@ pub const Compilation = struct {
             is_static,
             zig_lib_dir,
         );
-        return optional_comp orelse if (await frame) |_| unreachable else |err| err;
+        // TODO causes segfault
+        // return optional_comp orelse if (await frame) |_| unreachable else |err| err;
+        if (optional_comp) |comp| {
+            return comp;
+        } else if (await frame) |_| unreachable else |err| return err;
     }
 
     async fn createAsync(
src-self-hosted/main.zig
@@ -56,7 +56,8 @@ pub fn main() !void {
     // This allocator needs to be thread-safe because we use it for the event.Loop
     // which multiplexes async functions onto kernel threads.
     // libc allocator is guaranteed to have this property.
-    const allocator = std.heap.c_allocator;
+    // TODO https://github.com/ziglang/zig/issues/3783
+    const allocator = std.heap.page_allocator;
 
     stdout = &std.io.getStdOut().outStream().stream;
 
src-self-hosted/test.zig
@@ -26,7 +26,8 @@ test "stage2" {
 }
 
 const file1 = "1.zig";
-const allocator = std.heap.c_allocator;
+// TODO https://github.com/ziglang/zig/issues/3783
+const allocator = std.heap.page_allocator;
 
 pub const TestContext = struct {
     zig_compiler: ZigCompiler,
@@ -94,8 +95,8 @@ pub const TestContext = struct {
             &self.zig_compiler,
             "test",
             file1_path,
-            Target.Native,
-            Compilation.Kind.Obj,
+            .Native,
+            .Obj,
             .Debug,
             true, // is_static
             self.zig_lib_dir,
@@ -128,8 +129,8 @@ pub const TestContext = struct {
             &self.zig_compiler,
             "test",
             file1_path,
-            Target.Native,
-            Compilation.Kind.Exe,
+            .Native,
+            .Exe,
             .Debug,
             false,
             self.zig_lib_dir,
@@ -170,13 +171,13 @@ pub const TestContext = struct {
                     return error.OutputMismatch;
                 }
             },
-            .Error => |err| return err,
+            .Error => @panic("Cannot return error: https://github.com/ziglang/zig/issues/3190"), // |err| return err,
             .Fail => |msgs| {
                 const stderr = std.io.getStdErr();
                 try stderr.write("build incorrectly failed:\n");
                 for (msgs) |msg| {
                     defer msg.destroy();
-                    try msg.printToFile(stderr, errmsg.Color.Auto);
+                    try msg.printToFile(stderr, .Auto);
                 }
             },
         }