safer piping of documents
handling subprocess exceptions more gracefully