Skip to content

Commit b93e2c5

Browse files
checking for NotADirectoryError as well (#1948)
1 parent 9684833 commit b93e2c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

autogen/code_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def get_powershell_command():
219219
if result.returncode == 0:
220220
return "powershell"
221221

222-
except FileNotFoundError:
222+
except (FileNotFoundError, NotADirectoryError):
223223
# This means that 'powershell' command is not found so now we try looking for 'pwsh'
224224
try:
225225
result = subprocess.run(
@@ -228,7 +228,7 @@ def get_powershell_command():
228228
if result.returncode == 0:
229229
return "pwsh"
230230

231-
except FileNotFoundError:
231+
except (FileNotFoundError, NotADirectoryError):
232232
if WIN32:
233233
logging.warning("Neither powershell nor pwsh is installed but it is a Windows OS")
234234
return None

0 commit comments

Comments
 (0)