ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

REPL: Cannot exit infinite loop with Ctrl+C

Open martian17 opened this issue 2 years ago • 1 comments

Search Terms

infinite loop breakEvalOnSigint break

Expected Behavior

As soon as Ctrl+C is pressed, eval should throw "Uncaught Error: Script execution was interrupted by SIGINT", as in default node.js repl.

Actual Behavior

Loops indefinitely.

Steps to reproduce the problem

Open ts-node repl with ts-node, and type while(1){} and hit enter.

Minimal reproduction

$ ts-node
> while(1){}
// cannot exit

Specifications

  • ts-node version: v10.9.1
  • node version: v18.14.1
  • TypeScript version: v5.0.4
  • tsconfig.json, if you're using one: N/A
  • package.json: N/A
  • Operating system and version: Xubuntu 22.04.2 LTS x86_64
  • If Windows, are you using WSL or WSL2?: N/A

martian17 avatar Apr 27 '23 07:04 martian17

The problem is that Node does not support passing breakEvalOnSigint with a custom eval function - I don't know if there is a solution but I would be interested in one

SalvatorePreviti avatar Aug 05 '23 12:08 SalvatorePreviti