Ensure stdout and stderr of subprocess are always logged in export and import scripts, even in case of exception.