You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 preludelibLibCaliasDWORD=UInt32aliasBOOL=Int32funSetConsoleCtrlHandler(handlerRoutine : DWORD->BOOL, add : BOOL) : BOOLfunSleep(dwMilliseconds : DWORD)
endLibC.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.
The text was updated successfully, but these errors were encountered:
It launches cmd.exe - you can then launch a bunch of applications msinfo32, notepad etc
then if you close cmd.exe or press ctrl-c on the script all the applications in the process tree will exit
Is this something close to what you were hoping to achieve?
The point is that you are not supposed to be able to use Ctrl+C in the first place, because the code says so. It is perfectly fine to terminate the running code process using Task Manager or taskkill and the compiler will automatically exit. This is never a problem about the parent process not killing the child process on exit.
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 thebin/crystal
script, because it usesexec
to run the compiler, but not tobin\crystal.bat
andbin\crystal.ps1
, since Windows does not have a realexec
equivalent. Thus if the following script is run: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.
The text was updated successfully, but these errors were encountered: