Merge branch '8567-docker-migrator' refs #8567
[arvados.git] / services / api / lib / crunch_dispatch.rb
index 7c9fa0a25360ac959e521bbc8677554d7a23d3ad..bea1657de22b72c0d5296a4c571afcee3ffc0993 100644 (file)
@@ -963,10 +963,11 @@ class CrunchDispatch
   # An array of job_uuids in squeue
   def squeue_jobs
     if Rails.configuration.crunch_job_wrapper == :slurm_immediate
-      IO.popen(['squeue', '-a', '-h', '-o', '%j']) do |squeue_pipe|
-        squeue_pipe.readlines.map do |line|
-          line.strip
-        end
+      p = IO.popen(['squeue', '-a', '-h', '-o', '%j'])
+      begin
+        p.readlines.map {|line| line.strip}
+      ensure
+        p.close
       end
     else
       []