From 06da40cdcd0705c7eb8d05027d9e8db2cb1bc121 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 19 Mar 2016 11:32:15 -0600 Subject: [PATCH] Keep Dynamips stdout log file in the project directory. --- gns3server/modules/dynamips/hypervisor.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gns3server/modules/dynamips/hypervisor.py b/gns3server/modules/dynamips/hypervisor.py index 127e9239..18c35352 100644 --- a/gns3server/modules/dynamips/hypervisor.py +++ b/gns3server/modules/dynamips/hypervisor.py @@ -21,7 +21,6 @@ Represents a Dynamips hypervisor and starts/stops the associated Dynamips proces import os import subprocess -import tempfile import asyncio from gns3server.utils.asyncio import wait_for_process_termination @@ -120,10 +119,9 @@ class Hypervisor(DynamipsHypervisor): self._command = self._build_command() try: log.info("Starting Dynamips: {}".format(self._command)) - - with tempfile.NamedTemporaryFile(delete=False) as fd: - self._stdout_file = fd.name - log.info("Dynamips process logging to {}".format(fd.name)) + self._stdout_file = os.path.join(self.working_dir, "dynamips_i{}_stdout.txt".format(self._id)) + log.info("Dynamips process logging to {}".format(self._stdout_file)) + with open(self._stdout_file, "w", encoding="utf-8") as fd: self._process = yield from asyncio.create_subprocess_exec(*self._command, stdout=fd, stderr=subprocess.STDOUT,