gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.28k stars 10.31k forks source link

Terminal left in semi-unusable state after `gatsby build` #37512

Closed tony-o closed 1 year ago

tony-o commented 1 year ago

Preliminary Checks

Description

The terminal is left in a state different than gatsby found it. Running gatsby build results in the terminal no longer handling ctrl+d properly and eats the tab completion. This leads to things like :!gatsby build in vim requiring you exit vim because the editor is no longer usable. The terminal corrects itself when ctrl+c is issued and I think this may be related to #16621.

This is what happens after running the :!gatsby build from vim:

image

Reproduction Link

https://githubbox.com/gatsbyjs/gatsby-starter-minimal

Steps to Reproduce

  1. Run bash
  2. Run gatsby build
  3. Try to use tab completion
  4. Hit Ctrl+C
  5. Try to use tab completion

Expected Result

  1. Bash prompts you for commands it's aware of
  2. Bash prompts you for commands it's aware of

Actual Result

  1. Tab characters are printed out
  2. Bash prompts you for commands it's aware of

Environment

System:
    OS: Linux 6.0 openSUSE Tumbleweed 20221209
    CPU: (40) x64 Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
    Shell: 5.2.12 - /bin/bash
  Binaries:
    Node: 19.4.0 - ~/.local/src/nvm/versions/node/v19.4.0/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 9.2.0 - ~/.local/src/nvm/versions/node/v19.4.0/bin/npm
  Languages:
    Python: 2.7.18 - /usr/bin/python
  Browsers:
    Chrome: 108.0.5359.98
    Firefox: 109.0
  npmPackages:
    gatsby: ^5.4.2 => 5.4.2

Config Flags

No response

pieh commented 1 year ago

In effort to narrow things down a bit - could you try using GATSBY_LOGGER=yurnalist env var together with gatsby build and report wether it messes up terminal the same as default logger?

tony-o commented 1 year ago

@pieh just gave that a go and, yes, the logger env var+gatsby build still leaves the terminal in a strange state

tony-o commented 1 year ago

This is also happening with the same major version of bash on OSX. It's almost like the terminal is left with half of a control character sent, iterating search history via ctrl+r or up arrow and hitting enter still works but nothing prints to the console until the command itself prints and it prints in color as you'd expect.

I also tried building with the no color option set and that resulted in being left with the same unusuable vim/terminal.

Hitting tab a few times prints the tab characters, hitting enter directly afterwards prompts for command completion. This led me to believe that whatever eats STDIN during the process was being left open after the process completes but I ran out of time troubleshooting but did notice that if I gatsby build & my terminal's cursor was gone for the rest of the session (even with several ctrl+cs).

github-actions[bot] commented 1 year ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] commented 1 year ago

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜