[GHC] #3081: Double output after Ctrl+C on Windows

Neil Mitchell ndmitchell at gmail.com
Mon Mar 16 12:36:53 EDT 2009


>> system "cp foo foo.bup" >> deleteFile "foo"
>>
>> If I Ctrl+C during the cp did I just delete my one copy of foo?
>
> On Windows, Ctrl-C will unblock a blocked system call.  e.g. read() returns
> with zero.  Apparently system "foo" also returns as soon as you press
> Ctrl-C, I'm not entirely sure why.  Perhaps because the program has been
> killed?

So, to check my understanding:

* Haskell program invokes system
* Use presses Ctrl+C
* System returns and Haskell program continues executing
* Ctrl+C is thrown and Haskell program aborts

That sounds really dangerous - like a race condition between the
system returning and the Haskell program aborting.

Thanks

Neil


More information about the Glasgow-haskell-bugs mailing list