Unhandled exception: Error writing file: Broken pipe (Errno)

In my CLI application, I finally got rid of this annoying message with the following code:

begin
...
command.run
rescue ex : IO::Error
  if ex.os_error == Errno::EPIPE
    exit 0
  else
    raise ex
  end
rescue ex
...
end
5 Likes