close STDIN immediately if it is a simple exec
only write tmp files if they are needed