Fix output redirection of exec_prerun/_postrun