From 8a9f12eaa4e486bd494ee9cf40a8c2ead145bf8c Mon Sep 17 00:00:00 2001 From: Marek Fiala Date: Mon, 5 Jun 2023 17:54:05 +0200 Subject: [PATCH] Tools bugfix: Removed working directory when using idf.py Added check for existence of current working directory when using idf.py Closes https://github.com/espressif/esp-idf/issues/11476 --- tools/idf.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/idf.py b/tools/idf.py index a74439a069..915d050588 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -691,6 +691,12 @@ def main() -> None: # Check the environment only when idf.py is invoked regularly from command line. checks_output = None if SHELL_COMPLETE_RUN else check_environment() + # Check existance of the current working directory to prevent exceptions from click cli. + try: + os.getcwd() + except FileNotFoundError as e: + raise FatalError(f'ERROR: {e}. Working directory cannot be established. Check its existence.') + try: cli = init_cli(verbose_output=checks_output) except ImportError: