Skip to content

Commit

Permalink
Fix: Crystal::System::Process.fork exists on windows
Browse files Browse the repository at this point in the history
The method exists but raises NotImplementedError which causes
Process.new(pid) to fail because it doesn't exist with a `PidT`). This
patch fixes the issue by checking LibC.fork directly.

Weirdly, both were used before these changes and compilation did succeed.
  • Loading branch information
ysbaddaden committed Jan 30, 2024
1 parent b6efe8b commit 2f1af88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ module Crystal
return all_reused
end

{% if !Crystal::System::Process.class.has_method?("fork") %}
{% if !LibC.has_method?("fork") %}
raise "Cannot fork compiler. `Crystal::System::Process.fork` is not implemented on this system."
{% elsif flag?(:preview_mt) %}
raise "Cannot fork compiler in multithread mode"
Expand Down

0 comments on commit 2f1af88

Please sign in to comment.