By pressing Ctrl-C on a Unix-like system, you send your process a SIGINT signal, which will terminate the process by default.
Your program continues reading from input forever, because it blocks the call to io.lines() , which saves reading from standard input. To interrupt it, send the EOF terminal, this is done by pressing Ctrl-D on a Unix-like system.
On Windows, the key to send EOF is Ctrl-Z .
Yu Hao
source share