Skip to content

Commit

Permalink
Windows: Do not close process handle in Process#close
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Nov 20, 2023
1 parent 72e6b02 commit 8d190f0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions spec/std/process_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ describe Process do
{% end %}
end

# TODO: this spec gives "WaitForSingleObject: The handle is invalid."
# is this because standard streams on windows aren't async?
pending_win32 "can link processes together" do
it "can link processes together" do
buffer = IO::Memory.new
Process.run(*stdin_to_stdout_command) do |cat|
Process.run(*stdin_to_stdout_command, input: cat.output, output: buffer) do
Expand Down
2 changes: 2 additions & 0 deletions src/crystal/system/win32/process.cr
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ struct Crystal::System::Process
raise "BUG: Process still active"
end
exit_code
ensure
release
end

def exists?
Expand Down
1 change: 0 additions & 1 deletion src/process.cr
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ class Process
close_io @input
close_io @output
close_io @error
@process_info.release
end

# Asks this process to terminate.
Expand Down

0 comments on commit 8d190f0

Please sign in to comment.