-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
{
"azure-cli": "2.0.80",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.0.80",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {}
}Describe the bug
az login triggers error with cmd.exe:
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
This is because az login uses a function called open_page_in_browser. If az login is run inside of WSL the following command is run:
subprocess.call(['cmd.exe', '/c', "start {}".format(url.replace('&', '^&'))])
Based on how WSL handles this command, the current directory uses a UNC path for calling cmd.exe. A UNC path is a result of wslpath -w $(pwd) which converts the current WSL Linux path to a Windows compatible path.
An example output for wslpath -w $(pwd) is:
\\wsl$\Ubuntu\home\myusername
To Reproduce
Run az login while using Windows Subsystem Linux (WSL)
Expected behavior
No error from cmd.exe and the current directory in WSL works as expected.
Environment summary
azure-cli inside of WSL Ubuntu
Additional context
I think the solution is to use powershell instead of cmd.
The following is equivalent to the current cmd command:
subprocess.call(['powershell.exe', 'Start-Process', '-FilePath', "start {}".format(url.replace('&', '^&'))])