@@ -11,13 +11,22 @@ if [[ "${#CORE_DUMPS[@]}" > 0 ]]; then
11
11
echo " --- List of core dumps"
12
12
ls -lah " ${CORE_DUMPS[@]} "
13
13
14
- # Start compressing/collecting corefiles in the background
14
+ # Start a subshell for compressing/collecting corefiles in the background in parallel
15
+ (
15
16
PIDS=()
16
17
for COREFILE in " ${CORE_DUMPS[@]} " ; do
17
- compress_bundle " ${COREFILE} " &
18
+ (
19
+ compress_bundle " ${COREFILE} "
20
+ buildkite-agent artifact upload " $( compressed_bundle_names " ${COREFILE} " ) "
21
+ ) &
18
22
PIDS+=( " $! " )
19
23
done
20
24
25
+ # Wait for compression and upload to finish
26
+ wait -f " ${PIDS[@]} "
27
+ ) &
28
+ UPLOAD_PID=" $! "
29
+
21
30
# If we're given debugger commands, print them out here:
22
31
if [[ " ${# DBG_COMMANDS[@]} " > 0 ]]; then
23
32
# Spit some preliminary information out into the log for each corefile
@@ -32,22 +41,12 @@ if [[ "${#CORE_DUMPS[@]}" > 0 ]]; then
32
41
(sleep " ${DEBUGGER_TIMEOUT} " ; kill " ${DBG_PID} " 2> /dev/null > /dev/null; echo " DEBUGGER KILLED BY WATCHDOG TIMER" ) &
33
42
34
43
# Wait for one debugging command to finish before starting the next
35
- wait " ${DBG_PID} " || true
44
+ wait -f " ${DBG_PID} " || true
36
45
done
37
46
done
38
47
fi
39
48
40
- # Wait for compression to finish
41
- echo " --- Waiting upon compression/bundling"
42
- for PID in " ${PIDS[@]} " ; do
43
- wait " ${PID} "
44
- done
49
+ echo " --- Waiting upon compression/bundling finishing"
50
+ wait -f " ${UPLOAD_PID} "
45
51
echo " -> done!"
46
-
47
- # Upload all compressed core files
48
- echo " --- Uploading corefiles"
49
- UPLOAD_TARGETS=( $( compressed_bundle_names " ${CORE_DUMPS[@]} " ) )
50
- for TARGET in " ${UPLOAD_TARGETS[@]} " ; do
51
- buildkite-agent artifact upload " ${TARGET} "
52
- done
53
52
fi
0 commit comments