Hi there,
When I run a process twice in windows, crystal seems to hang.
I was wondering if this is a known issue for the windows version of crystal? (I know windows support is in development). I’m using crystal-nightly via scoop.
Here’s a reproduction:
#>crystal -v
#Crystal 1.7.0-dev [1c33a0b] (2022-10-29)
#LLVM: 13.0.0
#Default target: x86_64-pc-windows-msvc
def run_proc(command, a)
stdout = IO::Memory.new
stderr = IO::Memory.new
begin
mini_proc = Process.run(command, args: a, output: stdout, error: stderr)
if mini_proc.success?
return stdout.to_s
else
return "error" #stderr.to_s
end
rescue ex
return "error"
end
end
# This part works fine on windows
puts "windows version"
puts run_proc("wmic", ["os", "get", "Caption", "/value"]).strip
# This part stalls after 'try wmic' and never prints the 'acting on ... ' messages
os_info = ""
puts "try uname"
if run_proc("uname", ["-a"]) == "error" # linux/mac/bsd fail
puts "try wmic"
if run_proc("wmic", ["os", "get", "Caption", "/value"]) == "error" # windows fail
puts "acting on wmic fail"
os_info = "Unknown"
else # windows success
puts "acting on wmic success"
os_info = run_proc("wmic", ["os", "get", "Caption", "/value"]).strip
end
else # linux/mac/bsd success
os_info = run_proc("uname", ["-a"])
end
puts os_info