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

[rush] Certain npm scripts break the console inputs after ctrl+c #3154

Open
anantoghosh opened this issue Jan 13, 2022 · 4 comments
Open

[rush] Certain npm scripts break the console inputs after ctrl+c #3154

anantoghosh opened this issue Jan 13, 2022 · 4 comments

Comments

@anantoghosh
Copy link

Summary

Some npm scripts which run a continuous process, cause the console to behave weirdly after closing via ctrl+c.
While in running other (non rush) commands, ctrl+c waits for "Terminate batch job?", but when running the problematic scripts via rush, ctrl+c instantly ends the running process but shows "Terminate batch job" after a few seconds overlaying the cli. After which the console stops accepting any proper input and trying to ctrl+c again after a while starts skipping every other input, forcing us to close it completely.

Here you can see the state after ctrl+c, trying to run ls does not work. It's showing "Terminate batch job?" but that does not accept any inputs. ctrl+c again does not fix it. After a while it start skipping every second input.

image

Similar behavior with rush custom command running rush-select.

image

We observe the issue in multiple different systems.
It can be seen with powershell core 7, powershell 5 and cmd.

Repro steps

I've added a repo for you to check out.
I'm using the default stencil https://stenciljs.com/ starter here, and running its dev server will cause the problem.
I've also added a auto installer rush select which runs @telia/rush-select.

Minimal repo
https://github.com/anantoghosh/rush-cli-issue

Details

Running scripts with npm or pnpm behave as expected. We use it as a workaround.
But we don't have that option when running rush custom commands.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.59.2
rushVersion from rush.json? 5.59.2
useWorkspaces from rush.json? true
Operating system? Windows
Would you consider contributing a PR? Yes
Node.js version (node -v)? 16.13.1
@anantoghosh
Copy link
Author

It seems that running the bin related scripts directly do not have these issues.

{
      "name": "select-node",
      "commandKind": "global",
      "summary": "Run rush-select",
      "safeForSimultaneousRushProcesses": true,
      "autoinstallerName": "select",
      "shellCommand": "node ./common/autoinstallers/select/node_modules/@telia/rush-select/dist/index.js"
    }

This works fine. So I have a workaround for both cases now.

@Faithfinder
Copy link
Contributor

#2638 probably related

@elliot-nelson
Copy link
Collaborator

elliot-nelson commented Jan 27, 2022

I investigated something similar in #2613.

To clarify: can you recreate this problem with rushx, or is it only a rush problem?

For example, do you have a script in a package where running pnpm blah handles Ctrl+C correctly, but rushx blah does not? (And if so, could you include the --version output of the pnpm that works.)

(EDIT: And your pnpm version set in the rush.json, if applicable... it is possible that the pnpm pointed at by your shell is a different version than the one rush is executing.)

@anantoghosh
Copy link
Author

anantoghosh commented Jan 27, 2022

@elliot-nelson Hi yes the issue is present with both rush and rushx, I have included both the cases in the repo I provided https://github.com/anantoghosh/rush-cli-issue, you could try running the start script in the stencil folder.

Running the script via global pnpm or even npm has no issues.

For the given repo, I did keep both the globally installed pnpm and the rush pnpm version to the same version v6.26.0.

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

No branches or pull requests

3 participants