Skip to content

Commit

Permalink
espidf: fix subprocess related bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp v. K committed Mar 11, 2022
1 parent afbb605 commit 241653a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions mlonmcu/platform/espidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def invoke_idf_exe(self, *args, **kwargs):
+ " ".join([str(arg) for arg in args])
)
out = utils.exec_getout(
cmd, shell=True, env=env, **kwargs
cmd, shell=True, env=env, **kwargs, executable="/bin/bash"
) # TODO: using shell=True is insecure but right now we can not avoid it?
return out

Expand Down Expand Up @@ -340,7 +340,9 @@ def _monitor_helper(*args, verbose=False, start_match=None, end_match=None, time
+ f"> /dev/null && {self.idf_exe} "
+ " ".join([str(arg) for arg in args])
)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, env=env)
process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, executable="bin/bash", env=env
)
try:
exit_code = None
for line in process.stdout:
Expand Down
2 changes: 1 addition & 1 deletion mlonmcu/setup/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,6 @@ def install_espidf(context: MlonMcuContext, params=None, rebuild=False, verbose=
espidfInstallScript = Path(espidfSrcDir) / "install.sh"
env = {} # Do not use current virtualenv (TODO: is there a better way?)
env["IDF_TOOLS_PATH"] = str(espidfInstallDir)
env["PATH"] = "/usr/bin"
env["PATH"] = "/usr/bin:/bin" # TODO: find a better way to achieve this
utils.exec_getout(espidfInstallScript, boards, live=verbose, env=env)
context.cache["espidf.install_dir"] = espidfInstallDir

0 comments on commit 241653a

Please sign in to comment.