Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug:Unhandled exception: Not Implemented: Crystal::System::Signal.trap (NotImplementedError) from D:\Dev\Crystal\src\crystal\system\win32\signal.cr:5 in 'trap' #665

Closed
lansn opened this issue Oct 8, 2023 · 2 comments

Comments

@lansn
Copy link

lansn commented Oct 8, 2023

Description

[Unhandled exception: Not Implemented: Crystal::System::Signal.trap (NotImplementedError)
from D:\Dev\Crystal\src\crystal\system\win32\signal.cr:5 in 'trap']

Steps to Reproduce

step 1: create file: src/web.cr
require "kemal"

get "/" do
"Hello World!"
end

Kemal.run

step 2: crystal run src/web.cr

crystal run src\web.cr
Unhandled exception: Not Implemented: Crystal::System::Signal.trap (NotImplementedError)
from D:\Dev\Crystal\src\crystal\system\win32\signal.cr:5 in 'trap'
from D:\Dev\Crystal\src\signal.cr:117 in 'trap'
from lib\kemal\src\kemal.cr:92 in 'setup_trap_signal'
from lib\kemal\src\kemal.cr:39 in 'run'
from lib\kemal\src\kemal.cr:16 in 'run'
from src\web.cr:11 in '__crystal_main'
from D:\Dev\Crystal\src\crystal\main.cr:129 in 'main_user_code'
from D:\Dev\Crystal\src\crystal\main.cr:115 in 'main'
from D:\Dev\Crystal\src\crystal\main.cr:141 in 'main'
from D:\Dev\Crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
from D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
from C:\Windows\System32\KERNEL32.DLL +95044 in 'BaseThreadInitThunk'
from C:\Windows\SYSTEM32\ntdll.dll +337585 in 'RtlUserThreadStart'
Error deleting file: 'C:\Users\bl\AppData\Local\crystal\cache\crystal-run-web.exe.tmp.exe': Permission denied (File::AccessDeniedError)
from D:\a\crystal\crystal\src\crystal\system\win32\file.cr:283 in 'delete:raise_on_missing'
from D:\a\crystal\crystal\src\compiler\crystal\command.cr:266 in 'execute'
from D:\a\crystal\crystal\src\compiler\crystal\command.cr:231 in 'run_command'
from D:\a\crystal\crystal\src\compiler\crystal.cr:11 in '__crystal_main'
from D:\a\crystal\crystal\src\crystal\main.cr:141 in 'main'
from D:\a\crystal\crystal\src\crystal\system\win32\wmain.cr:37 in 'wmain'
from D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
from C:\Windows\System32\KERNEL32.DLL +95044 in 'BaseThreadInitThunk'
from C:\Windows\SYSTEM32\ntdll.dll +337585 in 'RtlUserThreadStart'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

Versions

win10 x64 22H2 19045.3448, crystal 1.9.2, kemal 1.4.0

@grkek
Copy link
Contributor

grkek commented Oct 11, 2023

I remember Kemal implementing the platform agnostic trapping, but now when I view the source code it seems like it might have been lost in commits.

Anyway you can extend the Kemal module for now for a temporary fix

module Kemal
  private def self.setup_trap_signal
    Process.on_interrupt {
      Kemal.stop
      exit
    }
  end
end

Save this into a file named extension.cr and require it right after you require the Kemal lib, for example:

require "kemal"
require "./extension.cr"

I will make a PR to fix this issue.

@Sija
Copy link
Contributor

Sija commented Apr 3, 2024

Should be fixed by #666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants