Lines 67-74
Link Here
|
67 |
|
67 |
|
68 |
# Setup a pipe for children to write their pids to when they finish. |
68 |
# Setup a pipe for children to write their pids to when they finish. |
69 |
local pipe="${T}/multijob.pipe" |
69 |
local pipe="${T}/multijob.pipe" |
70 |
mkfifo "${pipe}" |
70 |
mkfifo -m 600 "${pipe}" |
71 |
redirect_alloc_fd mj_control_fd "${pipe}" |
71 |
redirect_alloc_fd mj_write_fd "${pipe}" |
|
|
72 |
redirect_alloc_fd mj_read_fd "${pipe}" |
72 |
rm -f "${pipe}" |
73 |
rm -f "${pipe}" |
73 |
|
74 |
|
74 |
# See how many children we can fork based on the user's settings. |
75 |
# See how many children we can fork based on the user's settings. |
Lines 120-126
Link Here
|
120 |
esac |
121 |
esac |
121 |
|
122 |
|
122 |
if [[ $# -eq 0 ]] ; then |
123 |
if [[ $# -eq 0 ]] ; then |
123 |
trap 'echo ${BASHPID} $? >&'${mj_control_fd} EXIT |
124 |
trap 'echo ${BASHPID} $? >&'${mj_write_fd} EXIT |
124 |
trap 'exit 1' INT TERM |
125 |
trap 'exit 1' INT TERM |
125 |
else |
126 |
else |
126 |
local ret |
127 |
local ret |
Lines 169-175
Link Here
|
169 |
[[ $# -eq 0 ]] || die "${FUNCNAME} takes no arguments" |
170 |
[[ $# -eq 0 ]] || die "${FUNCNAME} takes no arguments" |
170 |
|
171 |
|
171 |
local pid ret |
172 |
local pid ret |
172 |
read -r -u ${mj_control_fd} pid ret || die |
173 |
read -r -u ${mj_read_fd} pid ret || die |
173 |
: $(( --mj_num_jobs )) |
174 |
: $(( --mj_num_jobs )) |
174 |
return ${ret} |
175 |
return ${ret} |
175 |
} |
176 |
} |