Skip to content

Commit

Permalink
fix(core): fix eslint --help command (#23274)
Browse files Browse the repository at this point in the history
<!-- 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)
  • Loading branch information
xiongemi authored and FrozenPandaz committed May 15, 2024
1 parent 8003766 commit d3ea7c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/nx/src/command-line/run/run.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { env as appendLocalEnv } from 'npm-run-path';
import {
combineOptionsForExecutor,
handleErrors,
Expand Down Expand Up @@ -131,16 +132,23 @@ async function printTargetRunHelpInternal(
) {
const command = targetConfig.options.command.split(' ')[0];
const helpCommand = `${command} --help`;
const localEnv = appendLocalEnv();
const env = {
...process.env,
...localEnv,
};
if (PseudoTerminal.isSupported()) {
const terminal = getPseudoTerminal();
await new Promise(() => {
const cp = terminal.runCommand(helpCommand);
const cp = terminal.runCommand(helpCommand, { jsEnv: env });
cp.onExit((code) => {
process.exit(code);
});
});
} else {
const cp = exec(helpCommand);
const cp = exec(helpCommand, {
env,
});
cp.on('exit', (code) => {
process.exit(code);
});
Expand Down

0 comments on commit d3ea7c2

Please sign in to comment.