gromero commented on a change in pull request #10678:
URL: https://github.com/apache/tvm/pull/10678#discussion_r832256452



##########
File path: apps/microtvm/zephyr/template_project/microtvm_api_server.py
##########
@@ -746,17 +746,15 @@ def open(self):
         os.mkfifo(self.write_pipe)
         os.mkfifo(self.read_pipe)
 
-        if "gdbserver_port" in self.options:
-            if "env" in self.kwargs:
-                self.kwargs["env"] = copy.copy(self.kwargs["env"])
-            else:
-                self.kwargs["env"] = os.environ.copy()
-
-            self.kwargs["env"]["TVM_QEMU_GDBSERVER_PORT"] = 
str(self.options["gdbserver_port"])
+        env = None
+        if self.options.get("gdbserver_port"):
+            env = os.environ.copy()
+            env["TVM_QEMU_GDBSERVER_PORT"] = self.options["gdbserver_port"]
 
         self.proc = subprocess.Popen(
             ["make", "run", f"QEMU_PIPE={self.pipe}"],
             cwd=BUILD_DIR,
+            env=env,

Review comment:
       @leandron Hi. Yes, `env=None` sets the same default behavior as when no 
`env` is passed (because `env` param's default is `None`), hence if 
`gdbserver_port` is not present in `options` dict the behavior will be exactly 
as it's currently (without the change here proposed), i.e. `Popen()` will 
inherit the current process’ environment. Otherwise, if `gdbserver_port` is 
present, the current process env is copied and `TVM_QEMU_GDBSERVER_PORT` var is 
set accordingly in the env and then env is passed to Popen().




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to