Skip to content

Commit 369e933

Browse files
committed
Use environment tempdir variable for parallel IPC directory
1 parent a4a9959 commit 369e933

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/octocatalog-diff/util/parallel.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# this instead executes the tasks serially, but provides the same API as the parallel tasks.
77

88
require 'stringio'
9+
require_relative 'util'
910

1011
module OctocatalogDiff
1112
module Util
@@ -107,14 +108,14 @@ def self.run_tasks(task_array, logger = nil, parallelized = true, raise_exceptio
107108
# @return [Exception] First exception encountered by a child process; returns nil if no exceptions encountered.
108109
def self.run_tasks_parallel(result, task_array, logger)
109110
pidmap = {}
110-
ipc_tempdir = Dir.mktmpdir('ocd-ipc-')
111+
ipc_tempdir = OctocatalogDiff::Util::Util.temp_dir('ocd-ipc-')
111112

112113
# Child process forking
113114
task_array.each_with_index do |task, index|
114115
# simplecov doesn't see this because it's forked
115116
# :nocov:
116117
this_pid = fork do
117-
ENV['OCTOCATALOG_DIFF_TEMPDIR'] = ipc_tempdir
118+
ENV['OCTOCATALOG_DIFF_TEMPDIR'] ||= ipc_tempdir
118119
task_result = execute_task(task, logger)
119120
File.open(File.join(ipc_tempdir, "#{Process.pid}.dat"), 'w') { |f| f.write Marshal.dump(task_result) }
120121
Kernel.exit! 0 # Kernel.exit! avoids at_exit from parents being triggered by children exiting

0 commit comments

Comments
 (0)