Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel "run-commands" does not exit with an error code when a command fails #28477

Open
4 tasks
ChrisSargent opened this issue Oct 16, 2024 · 0 comments
Open
4 tasks

Comments

@ChrisSargent
Copy link

Current Behavior

Using a project.json like this:

"testTask": {
  "executor": "nx:run-commands",
  "options": {
    "commands": ["./scripts/some-failing-script.sh", "./run-my-server.js"],
    "parallel": true,
    "cwd": "{projectRoot}"
  }
}

When the some-failing-script.sh it does not fail the task and the task keeps running in bad state. e.g. we use this for setting up a proxy and a webserver for running tests. If the proxy fails, we want the whole task to fail immediately too (because none of the tests will pass now anyway).

I believe this is a bug because the code running the commands is written to handle errors (see:

) but r.result.success is returned as true even when the command fails with a 1 exit code.

We tried a workaround of using a readyWhen entry set to the error message and whilst this does stop the task, it also exists the whole Nx task with a success error code.

Expected Behavior

If a command being ran in parallel fails, the whole task should also fail immediately.

GitHub Repo

No response

Steps to Reproduce

  1. Add a task with a configuration as above
  2. Call a failing script and a long running script (such as a server) in the parallel commands

Nx Report

Node : 20.18.0
OS : darwin-arm64
Native Target : aarch64-macos
yarn : 4.5.0

nx : 19.5.6
@nx/js : 19.5.6
@nx/jest : 19.5.6
@nx/linter : 19.5.6
@nx/eslint : 19.5.6
@nx/workspace : 19.5.6
@nx/cypress : 19.5.6
@nx/devkit : 19.5.6
@nx/esbuild : 19.5.6
@nx/eslint-plugin : 19.5.6
@nx/node : 19.5.6
@nx/playwright : 19.5.6
@nx/react : 19.5.6
@nx/storybook : 19.5.6
@nrwl/tao : 19.5.6
@nx/web : 19.5.6
@nx/webpack : 19.5.6
typescript : 5.3.3

Registered Plugins:
@nx/playwright/plugin
@nx/storybook/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

No response

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

No branches or pull requests

1 participant