Handle nesting in with_task_stdout again

When with_task_stdout is called inside its own invocation, create
a temporary Writer for stdout.