Skip to content

Commit 4c33cb8

Browse files
author
Tom Dyas
committed
don't pass input_digest to InteractiveProcess if run_in_workspace=True
[ci skip-rust] [ci skip-build-wheels]
1 parent df99123 commit 4c33cb8

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/python/pants/backend/python/goals/repl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def create_python_repl_request(repl: PythonRepl, pex_env: PexEnvironment)
7171
"PEX_PATH": repl.in_chroot(local_dists.pex.name),
7272
}
7373

74-
return ReplRequest(digest=merged_digest, args=args, extra_env=extra_env, run_in_workspace=False)
74+
return ReplRequest(digest=merged_digest, args=args, extra_env=extra_env)
7575

7676

7777
class IPythonRepl(ReplImplementation):
@@ -148,7 +148,7 @@ async def create_ipython_repl_request(
148148
"PEX_EXTRA_SYS_PATH": os.pathsep.join(chrooted_source_roots),
149149
}
150150

151-
return ReplRequest(digest=merged_digest, args=args, extra_env=extra_env, run_in_workspace=False)
151+
return ReplRequest(digest=merged_digest, args=args, extra_env=extra_env)
152152

153153

154154
def rules():

src/python/pants/core/goals/repl.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from pants.engine.environment import CompleteEnvironment
1515
from pants.engine.fs import Digest, Workspace
1616
from pants.engine.goal import Goal, GoalSubsystem
17+
from pants.engine.internals.native_engine import EMPTY_DIGEST
1718
from pants.engine.process import InteractiveProcess, InteractiveProcessResult
1819
from pants.engine.rules import Effect, Get, collect_rules, goal_rule
1920
from pants.engine.target import Targets, TransitiveTargets, TransitiveTargetsRequest
@@ -134,20 +135,24 @@ async def run_repl(
134135
)
135136
request = await Get(ReplRequest, ReplImplementation, repl_impl)
136137

137-
workspace.write_digest(
138-
request.digest,
139-
path_prefix=PurePath(tmpdir).relative_to(build_root.path).as_posix(),
140-
# We don't want to influence whether the InteractiveProcess is able to restart. Because
141-
# we're writing into a temp directory, we can safely mark this side_effecting=False.
142-
side_effecting=False,
143-
)
138+
input_digest = request.digest
139+
if request.run_in_workspace:
140+
workspace.write_digest(
141+
request.digest,
142+
path_prefix=PurePath(tmpdir).relative_to(build_root.path).as_posix(),
143+
# We don't want to influence whether the InteractiveProcess is able to restart. Because
144+
# we're writing into a temp directory, we can safely mark this side_effecting=False.
145+
side_effecting=False,
146+
)
147+
input_digest = EMPTY_DIGEST
148+
144149
env = {**complete_env, **request.extra_env}
145150
result = await Effect(
146151
InteractiveProcessResult,
147152
InteractiveProcess(
148153
argv=request.args,
149154
env=env,
150-
input_digest=request.digest,
155+
input_digest=input_digest,
151156
run_in_workspace=request.run_in_workspace,
152157
restartable=repl_subsystem.restartable,
153158
append_only_caches=request.append_only_caches,

0 commit comments

Comments
 (0)