Handle pipe failures

Sometimes when dokku hook fails it doesn't exit with not zero status code. This pull request fixed this on my side.