2

I am trying to combine two shell commands with concurrently lib and there should be option to forward user input into one of the child processes, see docs here, section --handle-input. But it somehow does not work in my case: npm script

    "test:unit": "concurrently --kill-others --handle-input --names test,build \"vitest --environment jsdom\" \"vite build --watch\"",

results in

[test]      Tests  1 failed | 12 passed (13)
[test]       Time  94ms
[test] 
[test] 
[test]  FAIL  Tests failed. Watching for file changes...
[test]        press u to update snapshot, press h to show help

I am pressing "u" as when I run it separately but nothing happen, even I tried to confirm by enter key.

So maybe I understand lib wrongly, or something. How can I pass my key strokes to child process "test"?

Thank you for any advise.

Luckylooke
  • 4,061
  • 4
  • 36
  • 49
  • I have found https://github.com/open-cli-tools/concurrently/issues/191#issuecomment-522210540 that it might be due to "raw stdin" which for now I don't understand yet as an frontend guy I didn’t meet that term yet.. I will try to google more to understand better – Luckylooke Aug 23 '22 at 13:08

1 Answers1

1

I get help in mentioned github issue. CREDIT to Mr. Pascal Jufer

Using --raw option did the thing!

So my final script is:

"test:unit": "concurrently --raw --kill-others --handle-input --names test,build \"vitest --environment jsdom\" \"vite build --watch\"",
Luckylooke
  • 4,061
  • 4
  • 36
  • 49