Skip to content

Commit

Permalink
fix(core): fix batch mode not streaming outputs (nrwl#17717)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and meeroslav committed Jun 23, 2023
1 parent b2e60e6 commit 55a701c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/nx/src/tasks-runner/run-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ async function getTerminalOutputLifeCycle(
): Promise<{ lifeCycle: LifeCycle; renderIsDone: Promise<void> }> {
const { runnerOptions } = getRunner(nxArgs, nxJson);
const isRunOne = initiatingProject != null;
const useDynamicOutput =
shouldUseDynamicLifeCycle(tasks, runnerOptions, nxArgs.outputStyle) &&
process.env.NX_VERBOSE_LOGGING !== 'true' &&
process.env.NX_TASKS_RUNNER_DYNAMIC_OUTPUT !== 'false';
const useDynamicOutput = shouldUseDynamicLifeCycle(
tasks,
runnerOptions,
nxArgs.outputStyle
);

const overridesWithoutHidden = { ...overrides };
delete overridesWithoutHidden['__overrides_unparsed__'];
Expand Down Expand Up @@ -195,10 +196,7 @@ export async function runCommand(
}

function setEnvVarsBasedOnArgs(nxArgs: NxArgs, loadDotEnvFiles: boolean) {
if (process.env.NX_BATCH_MODE === 'true') {
nxArgs.outputStyle = 'stream';
}
if (nxArgs.outputStyle == 'stream') {
if (nxArgs.outputStyle == 'stream' || process.env.NX_BATCH_MODE === 'true') {
process.env.NX_STREAM_OUTPUT = 'true';
process.env.NX_PREFIX_OUTPUT = 'true';
}
Expand Down Expand Up @@ -360,12 +358,18 @@ function shouldUseDynamicLifeCycle(
options: any,
outputStyle: string
) {
if (
process.env.NX_BATCH_MODE === 'true' ||
process.env.NX_VERBOSE_LOGGING === 'true' ||
process.env.NX_TASKS_RUNNER_DYNAMIC_OUTPUT === 'false'
) {
return false;
}
if (!process.stdout.isTTY) return false;
if (isCI()) return false;
if (outputStyle === 'static' || outputStyle === 'stream') return false;

const noForwarding = !tasks.find((t) => shouldStreamOutput(t, null, options));
return noForwarding;
return !tasks.find((t) => shouldStreamOutput(t, null, options));
}

export function getRunner(
Expand Down

0 comments on commit 55a701c

Please sign in to comment.