Skip to content

Commit 9068758

Browse files
chdemkocjames23
andauthored
Fix #2164 keep_env type error for hatch shell (#2165)
* Fix #2164 * Fix ruff --------- Co-authored-by: Cary Hawkins <hawkinscary23@gmail.com>
1 parent bc31cfc commit 9068758

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/hatch/cli/shell/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from __future__ import annotations
22

3+
import os
34
from typing import TYPE_CHECKING
45

56
import click
67

8+
from hatch.config.constants import AppEnvVars
9+
710
if TYPE_CHECKING:
811
from hatch.cli.application import Application
912

@@ -42,7 +45,7 @@ def shell(app: Application, env_name: str | None, name: str, path: str): # no c
4245

4346
with app.project.ensure_cwd():
4447
environment = app.project.get_environment(chosen_env)
45-
app.project.prepare_environment(environment)
48+
app.project.prepare_environment(environment, keep_env=bool(os.environ.get(AppEnvVars.KEEP_ENV)))
4649

4750
first_run_indicator = app.cache_dir / "shell" / "first_run"
4851
if not first_run_indicator.is_file():

0 commit comments

Comments
 (0)