def worker
loop do
{% if flag?(:win32) %}
p Process.run("D:/windows/tool.exe", ["-version"]).exit_code
{% else %}
p Process.run("/d/linux/tool", ["-version"]).exit_code
{% end %}
end
end
spawn do
worker
end
spawn do
worker
end
i = 0
loop do
p i
i += 1
sleep 0.1
end
Running the above code on linux works as expected (the two fibers getting the version of a tool, main fiber increments i value concurrently).
On windows it seems that the method Process.run is blocking the Scheduler. While the process is running the external command, no other fiber is scheduled, thus generating some output.
P.S:
Crystal 1.10.1 [c6f3552] (2023-10-13)
LLVM: 17.0.2
Default target: x86_64-pc-windows-msvc