Fix behavior of `print()` in module extensions
Previously, messages printed with `print()` didn't have the usual
`DEBUG:` prefix.
Fixes
Closes
@@ -85,6 +85,7 @@ public class SingleExtensionEvalFunction implements SkyFunction {
this.repositoryRemoteExecutor = repositoryRemoteExecutor;
}
+ @Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env)
throws SkyFunctionException, InterruptedException {
@@ -165,6 +166,7 @@ public class SingleExtensionEvalFunction implements SkyFunction {
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);
