Skip to content

Commit d3ea7c2

Browse files
xiongemiFrozenPandaz
authored andcommitted
fix(core): fix eslint --help command (#23274)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit a2a7d7e)
1 parent 8003766 commit d3ea7c2

File tree

1 file changed

+10
-2
lines changed
  • packages/nx/src/command-line/run

1 file changed

+10
-2
lines changed

packages/nx/src/command-line/run/run.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { env as appendLocalEnv } from 'npm-run-path';
12
import {
23
combineOptionsForExecutor,
34
handleErrors,
@@ -131,16 +132,23 @@ async function printTargetRunHelpInternal(
131132
) {
132133
const command = targetConfig.options.command.split(' ')[0];
133134
const helpCommand = `${command} --help`;
135+
const localEnv = appendLocalEnv();
136+
const env = {
137+
...process.env,
138+
...localEnv,
139+
};
134140
if (PseudoTerminal.isSupported()) {
135141
const terminal = getPseudoTerminal();
136142
await new Promise(() => {
137-
const cp = terminal.runCommand(helpCommand);
143+
const cp = terminal.runCommand(helpCommand, { jsEnv: env });
138144
cp.onExit((code) => {
139145
process.exit(code);
140146
});
141147
});
142148
} else {
143-
const cp = exec(helpCommand);
149+
const cp = exec(helpCommand, {
150+
env,
151+
});
144152
cp.on('exit', (code) => {
145153
process.exit(code);
146154
});

0 commit comments

Comments
 (0)