]> Dogcows Code - chaz/talk-event-driven-programming-in-perl/blobdiff - slides.html
add SIGPIPE slides
[chaz/talk-event-driven-programming-in-perl] / slides.html
index 6d589b4552d0e1edcb157ecabcd8f1e42d7d6b5f..51f91018b47b58dc661ea16ec0f31ef6e68920f0 100644 (file)
@@ -498,6 +498,39 @@ $promise->on_fail(sub { ... });
 ---
 class: center, middle
 
+## `SIGPIPE`
+
+---
+class: sigpipe
+## `SIGPIPE`
+
+- Sent to your program when it writes to a pipe that was closed.
+
+--
+- Default signal handler terminates the program.
+
+---
+class: ex-sigpipe
+
+## Solution: Ignore `SIGPIPE`
+
+```perl
+$SIG{PIPE} = 'IGNORE';
+```
+
+???
+Some event loops do this for you.
+
+--
+.big[
+Look for `EPIPE` from syscalls (like [`write`](http://man.he.net/man2/write)) instead.
+
+(You *are* checking return codes from your system calls... right?)
+]
+
+---
+class: center, middle
+
 ## Use [`Future::AsyncAwait`](https://metacpan.org/pod/Future::AsyncAwait).
 
 ???
This page took 0.019531 seconds and 4 git commands to generate.