runhook: buffer to tmp file when running multiple hooks