Open sobolk opened 1 year ago
I have attempted to use node-pty
instead of execa
to get some TTY emulation in https://github.com/aws-amplify/samsara-cli/pull/604 . I got stuck with e2e test job on Windows not completing within 60 min timeout.
Observations:
node-pty
does solve Ctrl+C signal propagation when using npx amplify
(instead of amplify
). I.e. Pseudo TTY dispatches signals to all processes in process group so they have ability to react.PredicatedAction
s , process spawning, process output and process exit. I also added output from tasklist
and wtfnode
to reveal what prevents node process from exiting.tasklist
after all tests ran does not contain any pid that was reported in test logswtfnode
seems to confirm that we're hitting this problem https://github.com/microsoft/node-pty/issues/437 , i.e. node-pty
leaves undisposed handles on Windows.Options to proceed
node-pty
fix. (This limits our testing capability)
npx
but lookup amplify binary and use it directly in all cases.I'm starting to think migrating to jest would be best. It has some nice utility methods that I miss from node:test in addition to this issue
From https://github.com/aws-amplify/samsara-cli/pull/575#discussion_r1382278621 .
When we try to call
npx amplify
in e2e tests then signals (SIGINT) do not reach child processes (i.e. sandbox).We should find a solution to this problem, or a workaround which will work in canary tests.
From PR ^ I was digging a bit and found this interesting article https://stackoverflow.com/questions/43788943/send-sigint-to-a-process-by-sending-ctrl-c-to-stdin . It says that TTY terminal dispatches SIGINT to foreground process group. Which might be our problem with npx and we might need a bit more than just execa for our e2e test framework.
I suggest we that this change as is and find solution for npx and SIGINT separately in a dedicated PR.