<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">the bug is known and will be fixed in Seed 3 (?).<div class="">signal based sources are mapped to TYPE_READ by mistake in the overlay.</div><div class=""><br class=""></div><div class="">Matt will confirm.</div><div class=""><br class=""></div><div class=""><br class=""><div class="">
-Pierre

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jul 7, 2016, at 7:13 PM, Darren Mo via swift-corelibs-dev &lt;<a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I am trying to catch SIGWINCH (terminal window size changed) in Swift 3 (Xcode 8 beta 2). The following code should exit with a status of 1 when it receives SIGWINCH. But it never exits.</div><div class=""><br class=""></div><div class="">```swift</div><div class=""><font face="Menlo" color="#5e30eb" class="">// compile with `xcrun -sdk macosx swiftc sigwinch.swift`</font></div><div class=""><font face="Menlo" color="#5e30eb" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#5e30eb" class="">import Darwin</font></div><div class=""><font face="Menlo" color="#5e30eb" class="">import Dispatch</font></div><div class=""><font face="Menlo" color="#5e30eb" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#5e30eb" class="">let source = DispatchSource.signal(signal: SIGWINCH, queue: DispatchQueue.main)</font></div><div class=""><font face="Menlo" color="#5e30eb" class="">source.setEventHandler {</font></div><div class=""><font face="Menlo" color="#5e30eb" class="">&nbsp; &nbsp;exit(1)</font></div><div class=""><font face="Menlo" color="#5e30eb" class="">}</font></div><div class=""><font face="Menlo" color="#5e30eb" class="">source.resume()</font></div><div class=""><font face="Menlo" color="#5e30eb" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#5e30eb" class="">dispatchMain()</font></div><div class="">```</div><div class=""><br class=""></div><div class="">The equivalent Objective-C code works as expected.</div><div class=""><br class=""></div><div class="">```objc</div><div class=""><div class=""><font face="Menlo" color="#4f7a28" class="">// compile with `xcrun -sdk macosx clang sigwinch.m`</font></div><div class=""><font face="Menlo" color="#4f7a28" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#4f7a28" class="">#import &lt;dispatch/dispatch.h&gt;</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">#import &lt;signal.h&gt;</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">#import &lt;stdlib.h&gt;</font></div><div class=""><font face="Menlo" color="#4f7a28" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#4f7a28" class="">int main() {</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp;dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL,</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SIGWINCH,</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0,</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dispatch_get_main_queue());</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp;dispatch_source_set_event_handler(source, ^{</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp; &nbsp; exit(1);</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp;});</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp;dispatch_resume(source);</font></div><div class=""><font face="Menlo" color="#4f7a28" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#4f7a28" class="">&nbsp; &nbsp;dispatch_main();</font></div><div class=""><font face="Menlo" color="#4f7a28" class="">}</font></div></div><div class="">```</div><div class=""><br class=""></div><div class="">What am I doing wrong?</div></div>_______________________________________________<br class="">swift-corelibs-dev mailing list<br class=""><a href="mailto:swift-corelibs-dev@swift.org" class="">swift-corelibs-dev@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-corelibs-dev<br class=""></div></blockquote></div><br class=""></div></body></html>