docker container の中で Poerty を使用した際に、 Unable to detect the current shell.
というエラーが出て virtualenv が起動できなかった。
ソースを読んだところ、 SHELL
が足りていないことがわかったので、
SHELL
を定義することで virtualenv が起動できた。
poetry/src/poetry/utils/shell.py
@classmethod
def get(cls) -> Shell:
"""
Retrieve the current shell.
"""
if cls._shell is not None:
return cls._shell
try:
name, path = detect_shell(os.getpid())
except (RuntimeError, ShellDetectionFailure):
shell = None
if os.name == "posix":
shell = os.environ.get("SHELL")
elif os.name == "nt":
shell = os.environ.get("COMSPEC")
if not shell:
raise RuntimeError("Unable to detect the current shell.")
name, path = Path(shell).stem, shell
cls._shell = cls(name, path)
return cls._shell