We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f76ceee commit 518b699Copy full SHA for 518b699
poetry/utils/shell.py
@@ -9,6 +9,7 @@
9
from shellingham import detect_shell
10
11
from ._compat import WINDOWS
12
+from ._compat import Path
13
from .env import VirtualEnv
14
15
@@ -42,7 +43,17 @@ def get(cls): # type: () -> Shell
42
43
try:
44
name, path = detect_shell(os.getpid())
45
except (RuntimeError, ShellDetectionFailure):
- raise RuntimeError("Unable to detect the current shell.")
46
+ shell = None
47
+
48
+ if os.name == "posix":
49
+ shell = os.environ.get("SHELL")
50
+ elif os.name == "nt":
51
+ shell = os.environ.get("COMSPEC")
52
53
+ if not shell:
54
+ raise RuntimeError("Unable to detect the current shell.")
55
56
+ name, path = Path(shell).stem, shell
57
58
cls._shell = cls(name, path)
59
0 commit comments