Skip to content

Commit

Permalink
refactor(exec): More coverage fixes (#23021)
Browse files Browse the repository at this point in the history
  • Loading branch information
zharinov authored Jun 28, 2023
1 parent 36ff13a commit 756a1c9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/util/exec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function getChildEnv({
}

function dockerEnvVars(extraEnv: ExtraEnv, childEnv: ExtraEnv): string[] {
const extraEnvKeys = Object.keys(extraEnv || {});
const extraEnvKeys = Object.keys(extraEnv);
return extraEnvKeys.filter((key) => is.nonEmptyString(childEnv[key]));
}

Expand Down Expand Up @@ -101,9 +101,10 @@ interface RawExecArguments {

async function prepareRawExec(
cmd: string | string[],
opts: ExecOptions = {}
opts: ExecOptions
): Promise<RawExecArguments> {
const { docker } = opts;
const preCommands = opts.preCommands ?? [];
const { customEnvVariables, containerbaseDir, binarySource } =
GlobalConfig.get();

Expand Down Expand Up @@ -132,21 +133,20 @@ async function prepareRawExec(
];
const cwd = getCwd(opts);
const dockerOptions: DockerOptions = { ...docker, cwd, envVars };
const preCommands = [
...(await generateInstallCommands(opts.toolConstraints)),
...(opts.preCommands ?? []),
];
const dockerCommand = await generateDockerCommand(
rawCommands,
preCommands,
[
...(await generateInstallCommands(opts.toolConstraints)),
...preCommands,
],
dockerOptions
);
rawCommands = [dockerCommand];
} else if (isDynamicInstall(opts.toolConstraints)) {
logger.debug('Using containerbase dynamic installs');
rawCommands = [
...(await generateInstallCommands(opts.toolConstraints)),
...(opts.preCommands ?? []),
...preCommands,
...rawCommands,
];
} else if (isHermit()) {
Expand Down

0 comments on commit 756a1c9

Please sign in to comment.