Skip to content

nx affected truncates buffered (failed) task output by exiting before stdout drains #36568

Description

@Jamie4224

Current Behavior

https://github.com/nrwl/nx/blob/master/packages/nx/src/command-line/affected/affected.ts#L90-L100

When running nx affected, the stdout is not drained before calling process.exit(). When a large output is currently buffered, like a large task output, it might not be sent to stdout and get cut off. This buffering can happen due to task grouping in Github Actions.

An example of this we are experiencing is a large e2e test report that is buffered and fails, but it not fully printed to the GH Actions log.

Expected Behavior

The output is drained to stdout before exiting.

Adding await output.drain(); before the process.exit() solves the issue.

GitHub Repo

https://github.com/Jamie4224/nx-output-bug-report

Steps to Reproduce

  1. Open the reproduction
  2. Run pnpm run reproduce, you will see "finished writing x's"
  3. Run ./reproduce, you won't see "finished writing x's"

Nx Report

NX   Report complete - copy this into the issue template

Node           : 24.18.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 11.15.1
daemon         : Available

nx             : 23.1.0
@nx/js         : 23.1.0
@nx/eslint     : 23.1.0
@nx/workspace  : 23.1.0
@nx/devkit     : 23.1.0
@nx/vite       : 23.1.0
@nx/vitest     : 23.1.0
typescript     : 5.9.3

Nx key
---------------------------------------
getNxKeyInformationAsync is not a function

---------------------------------------
Registered Plugins:
@nx/eslint/plugin
---------------------------------------
Community plugins:
@nx/gcs-cache : 5.0.0
---------------------------------------
Cache Usage: 61.03 MB / 92.64 GB

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Related:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions