Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Correctly closing pipe streams for interprocess communication

  • Loading branch information...
commit da90932f4415f3cbcf5e60f69f4447bfac63b48a 1 parent 01f851a
@andrewtimberlake authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/cascade/worker.rb
View
3  lib/cascade/worker.rb
@@ -40,6 +40,8 @@ def self.run_forked(job_spec)
read, write = IO.pipe
pid = fork do
+ read.close
+
job_class = job_spec.class_name.constantize
if job_class.respond_to?(:after_fork)
job_class.run_callbacks(:after_fork, job_spec)
@@ -51,6 +53,7 @@ def self.run_forked(job_spec)
else
write.puts '0'
end
+ write.close
end
write.close
result = read.read.strip
Please sign in to comment.
Something went wrong with that request. Please try again.