Skip to content

Commit

Permalink
Fix behavior of print() in module extensions
Browse files Browse the repository at this point in the history
Previously, messages printed with `print()` didn't have the usual
`DEBUG:` prefix.

Fixes #14526

Closes #15795.

PiperOrigin-RevId: 459052873
Change-Id: I1b75498d448aaae137dd63ea0a418572097bdac2
  • Loading branch information
fmeum authored and copybara-github committed Jul 5, 2022
1 parent 798e288 commit afb434d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void setRepositoryRemoteExecutor(RepositoryRemoteExecutor repositoryRemot
this.repositoryRemoteExecutor = repositoryRemoteExecutor;
}

@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
throws SkyFunctionException, InterruptedException {
Expand Down Expand Up @@ -165,6 +166,7 @@ public SkyValue compute(SkyKey skyKey, Environment env)
try (Mutability mu =
Mutability.create("module extension", usagesValue.getExtensionUniqueName())) {
StarlarkThread thread = new StarlarkThread(mu, starlarkSemantics);
thread.setPrintHandler(Event.makeDebugPrintHandler(env.getListener()));
ModuleExtensionContext moduleContext =
createContext(env, usagesValue, starlarkSemantics, extension);
threadContext.storeInThread(thread);
Expand Down

0 comments on commit afb434d

Please sign in to comment.