lib/tork/server.rb in tork-19.3.0 vs lib/tork/server.rb in tork-19.3.1

- old
+ new

@@ -99,11 +99,17 @@ Array(one_or_more_clients) end targets.each do |target| target = @stdout if target == STDIN - target.puts message - target.flush + begin + target.puts message + target.flush + rescue Errno::EPIPE + # the target closed itself asynchronously + # https://github.com/sunaku/tork/issues/53 + next + end end end def popen command child = IO.popen(command, 'r+')