Doubts about stopping command line process

Viewed 137

I found that when I execute

a = 1:a
a

in command line, I can press Ctrl+c to stop the infinite process.

But Ctrl+c fails to stop the process when I execute

length a

However, Ctrl+c works well when I execute

length [0..]

Why does Ctrl+c sometimes fail to stop the process? Is there any ways to stop the process when Ctrl+c is invalid?

1 Answers

Under Windows, there is a bug where, after pressing Ctrl + C, GHCI appears to exit but still seems to run in the background. The only documentation I could find is https://gitlab.haskell.org/ghc/ghc/-/issues/14150 but I've experienced it myself multiple times using version 9.2.1.when working with infinite data structures like infinite lists [1..].

Related