X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftalk-event-driven-programming-in-perl;a=blobdiff_plain;f=slides.html;h=51f91018b47b58dc661ea16ec0f31ef6e68920f0;hp=6d589b4552d0e1edcb157ecabcd8f1e42d7d6b5f;hb=309c1da6df9319b3bcd760fd3073bafeda9faf09;hpb=fa698f7b8f498a04b0394f5cadc2cadf0a6fb21a diff --git a/slides.html b/slides.html index 6d589b4..51f9101 100644 --- a/slides.html +++ b/slides.html @@ -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). ???