Using a tmpfile for output to avoid arg overflow