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

Interactive shell in the test process is erratic due to stdin being piped to both the server and the test processes #368

Closed
sarimarton opened this issue Aug 9, 2023 · 1 comment

Comments

@sarimarton
Copy link
Contributor

sarimarton commented Aug 9, 2023

Is this a bug report or a feature request?

Bug report

If this is a bug report, please provide as much info as possible

  • version: 2.0.0
  • platform: Windows 10 > WSL2 > Ubuntu 22
  • expected behavior > the shell in the test command works fine
  • actual behavior > the shell's input is glitchy

When using a test program which has interactive shell, the interactive shell will behave in an erratic way: some characters are not registered on keypress. It's randomly about 50% chance that the character is written to the test process's stdin. The exact case I'm running is with the 'smashtest' package. It's not really relevant, but for completeness, here is my command line:

start-test 'PORT=5001 npm start | dev-null' tcp:127.0.0.1:5001 'PORT=5001 smashtest tests/*.smash'

Smashtest is running a Node.js built-in REPL instance. I have debugged the problem and found that start-server-and-test uses stdio: 'inherit' on both the server and the test child processes, which doesn't make sense, as we can't control both. If I set the server to stdio: ['ignore', 'inherit', 'inherit'], the problem goes away.

I assume people didn't run into this problem because they either used this library with a non-interactive headless test session, or with a GUI test program.

I've made a PR which fixes the issue: #369

@sarimarton sarimarton changed the title stdin is glitchy with interactive test shells Interactive shell in the test process is erratic due to stdin being piped to both the server and the test processes Aug 9, 2023
@bahmutov
Copy link
Owner

closed in #369

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

No branches or pull requests

2 participants