From: Michael Stapelberg Date: Wed, 16 Jun 2010 17:26:55 +0000 (+0200) Subject: Bugfix: i3-wsbar: properly catch errors when writing to child process X-Git-Tag: 4.0~66 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a2402a5eb1a372d7f93650f6823a28ffa59a632e;p=i3%2Fi3 Bugfix: i3-wsbar: properly catch errors when writing to child process This comes at the expense of having Try::Tiny as additional dependency, but I think Try::Tiny is widely available. --- diff --git a/i3-wsbar b/i3-wsbar index 3c76864e..5536e92c 100755 --- a/i3-wsbar +++ b/i3-wsbar @@ -7,6 +7,7 @@ use warnings; use Getopt::Long; use Pod::Usage; use IPC::Run qw(start pump); +use Try::Tiny; use AnyEvent::I3; use AnyEvent; use v5.10; @@ -204,7 +205,12 @@ sub update_output { $out .= "\n"; $outputs->{$name}->{cmd_input} = $out; - pump $outputs->{$name}->{cmd} while length $outputs->{$name}->{cmd_input}; + try { + pump $outputs->{$name}->{cmd} while length $outputs->{$name}->{cmd_input}; + } catch { + warn "Could not write to dzen2"; + exit 1; + } } }