Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented Feb 28, 2020

Fix Azure/azure-cli#12239

On Linux, if the working directory has been deleted (or created later), getcwd will raise FileNotFoundError.

This PR fixes this issue by showing a warning and continue.

To test, run

mkdir t1
cd t1
rmdir ~/t1
python ~/knack/examples/exapp2 abc list

Now it shows warning:

The working directory has been deleted or recreated. Local config is ignored.

In Azure CLI, the warning appears twice because besides the initiation of CLIConfig from Knack

knack/knack/cli.py

Lines 83 to 86 in 2036b78

self.config = config_cls(
config_dir=config_dir or os.path.expanduser(os.path.join('~', '.{}'.format(cli_name))),
config_env_var_prefix=config_env_var_prefix or cli_name.upper()
)

Azure CLI is also creating a CLIConfig instance.

https://github.com/Azure/azure-cli/blob/77fcc2b071bd448e858807946e4f2ef66db9ae4e/src/azure-cli-core/azure/cli/core/extension/__init__.py#L16

az_config = CLIConfig(config_dir=GLOBAL_CONFIG_DIR, config_env_var_prefix=ENV_VAR_PREFIX)

We may fix it in Azure CLI later.

Copy link

@qianwens qianwens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az dls fs download should return message from service side instead of CLI core

3 participants