Skip to content

Commit 2109f81

Browse files
fhrbataMarek Fiala
authored andcommitted
fix(tools): do not include rc scripts in export script
The rc scripts should be included only when a new shell is started. At present, for bash and zsh, we are also including them in the export scripts, which is incorrect and may cause recursion. Closes #14584 Signed-off-by: Frantisek Hrbata <[email protected]>
1 parent eb606b9 commit 2109f81

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tools/export_utils/shell_types.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ def autocompletion(self) -> None:
7272
# Basic POSIX shells does not support autocompletion
7373
return None
7474

75-
def init_file(self) -> None:
76-
with open(self.script_file_path, 'w') as fd:
77-
self.export_file(fd)
78-
7975
def export_file(self, fd: TextIO) -> None:
8076
fd.write(f'{self.deactivate_cmd}\n')
8177
for var, value in self.new_esp_idf_env.items():
@@ -87,7 +83,8 @@ def export_file(self, fd: TextIO) -> None:
8783
'Go to the project directory and run:\n\n idf.py build"\n'))
8884

8985
def export(self) -> None:
90-
self.init_file()
86+
with open(self.script_file_path, 'w') as fd:
87+
self.export_file(fd)
9188
print(f'. {self.script_file_path}')
9289

9390
def click_ver(self) -> int:
@@ -188,6 +185,10 @@ def autocompletion(self) -> str:
188185
stdout: str = run_cmd([sys.executable, conf.IDF_PY], env=env)
189186
return stdout
190187

188+
def init_file(self) -> None:
189+
with open(self.script_file_path, 'w') as fd:
190+
self.export_file(fd)
191+
191192
def spawn(self) -> None:
192193
self.init_file()
193194
new_env = os.environ.copy()

0 commit comments

Comments
 (0)