Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@utarwyn
Copy link
Member

@utarwyn utarwyn commented Feb 27, 2025

This pull request includes a small change to the executeCommand function in the packages/nx-go/src/utils/execute-command.ts file. The change removes the default value of null for the cwd parameter, making it an optional parameter without a default value.

Closes #151

@utarwyn utarwyn added the type: bug Something isn't working label Feb 27, 2025
@utarwyn utarwyn self-assigned this Feb 27, 2025
@utarwyn utarwyn force-pushed the issue-151-shell-invalid-cwd branch from 97e8278 to 80d4d99 Compare February 27, 2025 22:43
@utarwyn utarwyn marked this pull request as ready for review February 27, 2025 22:54
@utarwyn utarwyn marked this pull request as draft June 12, 2025 22:01
@utarwyn utarwyn force-pushed the issue-151-shell-invalid-cwd branch from b3f99c5 to e6712e4 Compare June 12, 2025 22:12
@sonarqubecloud
Copy link

@phillipCouto
Copy link
Contributor

@utarwyn have a look at https://github.com/phillipCouto/nx-go/commits/issue-151-shell-invalid-cwd/?since=2025-08-24&until=2025-08-24

  1. I fixed the e2e tests to use the correct cwd. The reason we were seeing the spawn /bin/sh ENOENT error is because the cwd was pointing to a folder that does not exist. This is because the runNxCommandAsync would just add the projected cwd to the cwd the e2e command was running from and not the cwd within the workspace we created for the test.

  2. Created a utility to compute the cwd which will also be the root of the target project. Using the workspace root plus the root of the project so we can be within the target project folder regardless of where the user is executing the command within the workspace.

  3. Updated the generator to configure the targets correctly with the assumption we are running executors within the projects root consistently.

  4. Updated tests to now properly expect the command string factoring the consistent evaluation of cwd being the root of the project.

If you move ahead with my changes this will be a new major release as existing targets assuming the old cwd behaviour will need to be updated.

@phillipCouto
Copy link
Contributor

@utarwyn have a look at https://github.com/phillipCouto/nx-go/commits/issue-151-shell-invalid-cwd/?since=2025-08-24&until=2025-08-24

1. I fixed the e2e tests to use the correct cwd. The reason we were seeing the `spawn /bin/sh ENOENT` error is because the cwd was pointing to a folder that does not exist. This is because the `runNxCommandAsync` would just add the projected cwd to the cwd the e2e command was running from and not the cwd within the workspace we created for the test.

2. Created a utility to compute the cwd which will also be the root of the target project. Using the workspace root plus the root of the project so we can be within the target project folder regardless of where the user is executing the command within the workspace.

3. Updated the generator to configure the targets correctly with the assumption we are running executors within the projects root consistently.

4. Updated tests to now properly expect the command string factoring the consistent evaluation of cwd being the root of the project.

If you move ahead with my changes this will be a new major release as existing targets assuming the old cwd behaviour will need to be updated.

@utarwyn did you have a chance to look into my patch?

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

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Error: spawnSync /bin/sh ENOENT" when running lint from a different directory

3 participants