Skip to content

Comments

fix(core): commands shouldn't hang when passing --help#34506

Merged
FrozenPandaz merged 3 commits intomasterfrom
fix/help-handler-exit
Feb 20, 2026
Merged

fix(core): commands shouldn't hang when passing --help#34506
FrozenPandaz merged 3 commits intomasterfrom
fix/help-handler-exit

Conversation

@AgentEnder
Copy link
Member

@AgentEnder AgentEnder commented Feb 19, 2026

Current Behavior

--help on commands that hit yargs help are hanging

Expected Behavior

It doesn't hang. This contains a quick fix in adding the process.exit call, but also adds the unref needed to maintain previous working behavior. We'll need to investigate long term if additional areas keep commands alive, but adding this unref theoretically allows removing the process.exit calls from nx show

Related Issue(s)

Fixes #

@netlify
Copy link

netlify bot commented Feb 19, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 303e102
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/699887360d9c130008cb86f3
😎 Deploy Preview https://deploy-preview-34506--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 19, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 303e102
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/699887369624a10008982690
😎 Deploy Preview https://deploy-preview-34506--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Feb 19, 2026

View your CI Pipeline Execution ↗ for commit 303e102

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 45m 12s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3m 54s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 9s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-20 17:01:46 UTC

@AgentEnder AgentEnder force-pushed the fix/help-handler-exit branch from 253782e to bb154cc Compare February 19, 2026 02:51
@AgentEnder AgentEnder changed the title feat(core): add commands for debugging cache inputs / outputs fix(core): commands shouldn't hang when passing --help Feb 19, 2026
Copy link
Contributor

@nx-cloud nx-cloud bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud has identified a possible root cause for your failed CI:

Our investigation shows these e2e test failures are due to a missing @microsoft/api-extractor module (ConsoleMessageId) in the test environment, which is unrelated to the PR's changes (process exit handling and daemon socket lifecycle). The failures occur in e2e test projects that were not modified by this PR, and there's no logical connection between help command fixes and API Extractor module resolution issues.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

When running `nx show project --help` or similar commands that hit the
help path in init-local.ts, the process would hang indefinitely. This
is because yargs' built-in help is disabled (`.help(false)`) and the
daemon client's socket connections keep the Node.js event loop alive.

Adding `process.exit(0)` after `showHelp()` matches the pattern used
by other commands (e.g., `init`) that already handle this correctly.
The main daemon client socket created in setUpConnection() was keeping
the Node.js event loop alive after command completion, requiring every
command handler to call process.exit() explicitly.

By calling socket.unref(), the socket no longer prevents the process
from exiting naturally. The existing keep-alive setTimeout in
sendMessageToDaemon() ensures the process stays alive while actively
awaiting daemon responses.
@AgentEnder AgentEnder force-pushed the fix/help-handler-exit branch from c1c20fd to e0a692f Compare February 19, 2026 20:43
@FrozenPandaz FrozenPandaz merged commit df8a2c4 into master Feb 20, 2026
23 checks passed
@FrozenPandaz FrozenPandaz deleted the fix/help-handler-exit branch February 20, 2026 18:49
FrozenPandaz added a commit that referenced this pull request Feb 20, 2026
## Current Behavior
`--help` on commands that hit yargs help are hanging

## Expected Behavior
It doesn't hang. This contains a quick fix in adding the process.exit
call, but also adds the unref needed to maintain previous working
behavior. We'll need to investigate long term if additional areas keep
commands alive, but adding this unref theoretically allows removing the
process.exit calls from `nx show`

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
(cherry picked from commit df8a2c4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants