-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
kind:bugA bug in the code. Does not apply to documentation, specs, etc.A bug in the code. Does not apply to documentation, specs, etc.platform:windowsWindows support based on the MSVC toolchain / Win32 APIWindows support based on the MSVC toolchain / Win32 APItopic:infrastructuretopic:stdlib:system
Description
If Ctrl+C is ignored, naturally it becomes impossible to terminate the file being executed with crystal run
using that shortcut. The same also applies to the bin/crystal
script, because it uses exec
to run the compiler, but not to bin\crystal.bat
and bin\crystal.ps1
, since Windows does not have a real exec
equivalent. Thus if the following script is run:
Process.ignore_interrupts!
sleep
# minimal alternative for the empty prelude
lib LibC
alias DWORD = UInt32
alias BOOL = Int32
fun SetConsoleCtrlHandler(handlerRoutine : DWORD -> BOOL, add : BOOL) : BOOL
fun Sleep(dwMilliseconds : DWORD)
end
LibC.SetConsoleCtrlHandler(nil, 1)
LibC.Sleep(-1)
then Ctrl+C still exits the wrapper, leaving both the compiler and the compiled code running. This is problematic because if the user then attempts to run the same code again, a linker error occurs as overwriting a running process's file is not allowed on Windows. The only way out is to manually terminate the running code from Task Manager.
devnote-dev
Metadata
Metadata
Assignees
Labels
kind:bugA bug in the code. Does not apply to documentation, specs, etc.A bug in the code. Does not apply to documentation, specs, etc.platform:windowsWindows support based on the MSVC toolchain / Win32 APIWindows support based on the MSVC toolchain / Win32 APItopic:infrastructuretopic:stdlib:system
Type
Projects
Status
Todo