Source:
<code>protected SpawnResult actuallyExec(Spawn spawn, SpawnExecutionContext context) throws IOException, ExecException, InterruptedException { Path tmpDir = createActionTemp(execRoot); Path commandTmpDir = tmpDir.getRelative("work"); commandTmpDir.createDirectory(); Map<String, String> environment = <START> localEnvProvider.rewriteLocalEnv( <END> spawn.getEnvironment(), binTools, commandTmpDir.getPathString()); Map<PathFragment, Path> readablePaths = SandboxHelpers.processInputFiles( spawn, context, execRoot, getSandboxOptions().symlinkedSandboxExpandsTreeArtifactsInRunfilesTree); ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.addAll(getWritableDirs(execRoot, environment)); for (ActionInput output : spawn.getOutputFiles()) { writablePaths.add(execRoot.getRelative(output.getExecPath())); } Duration timeout = context.getTimeout(); WindowsSandboxUtil.CommandLineBuilder commandLineBuilder = WindowsSandboxUtil.commandLineBuilder(windowsSandbox, spawn.getArguments()) .setWritableFilesAndDirectories(writablePaths.build()) .setReadableFilesAndDirectories(readablePaths) .setInaccessiblePaths(getInaccessiblePaths()) .setUseDebugMode(getSandboxOptions().sandboxDebug) .setKillDelay(timeoutKillDelay); if (!timeout.isZero()) { commandLineBuilder.setTimeout(timeout); } Path statisticsPath = null; SandboxedSpawn sandbox = new DummySandboxedSpawn(execRoot, environment, commandLineBuilder.build()); return runSpawn(spawn, sandbox, context, execRoot, timeout, statisticsPath); }</code><technical_language>Ideally LocalEnvProvider.rewriteLocalEnv declare return a ImmutableMap of implementations do so. please change environment ImmutableMap ImmutableMap.copyOf(localEnvProvider.rewriteLocalEnv(...)) is fixed</technical_language>

Target:
protected SpawnResult actuallyExec(Spawn spawn, SpawnExecutionContext context) throws IOException, ExecException, InterruptedException { Path tmpDir = createActionTemp(execRoot); Path commandTmpDir = tmpDir.getRelative("work"); commandTmpDir.createDirectory(); ImmutableMap<String, String> environment = ImmutableMap.copyOf( localEnvProvider.rewriteLocalEnv( spawn.getEnvironment(), binTools, commandTmpDir.getPathString())); Map<PathFragment, Path> readablePaths = SandboxHelpers.processInputFiles( spawn, context, execRoot, getSandboxOptions().symlinkedSandboxExpandsTreeArtifactsInRunfilesTree); ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.addAll(getWritableDirs(execRoot, environment)); for (ActionInput output : spawn.getOutputFiles()) { writablePaths.add(execRoot.getRelative(output.getExecPath())); } Duration timeout = context.getTimeout(); WindowsSandboxUtil.CommandLineBuilder commandLineBuilder = WindowsSandboxUtil.commandLineBuilder(windowsSandbox, spawn.getArguments()) .setWritableFilesAndDirectories(writablePaths.build()) .setReadableFilesAndDirectories(readablePaths) .setInaccessiblePaths(getInaccessiblePaths()) .setUseDebugMode(getSandboxOptions().sandboxDebug) .setKillDelay(timeoutKillDelay); if (!timeout.isZero()) { commandLineBuilder.setTimeout(timeout); } Path statisticsPath = null; SandboxedSpawn sandbox = new WindowsSandboxedSpawn(execRoot, environment, commandLineBuilder.build()); return runSpawn(spawn, sandbox, context, execRoot, timeout, statisticsPath); }