File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,14 @@ function get_process_cmdline() {
24
24
# We can scan processes before process's exec() and get wrong command_line
25
25
function wait_for_process() {
26
26
local PID=" $1 "
27
+ local PROC_NAME=" $2 "
28
+ if [[ -z " $PROC_NAME " ]]; then
29
+ PROC_NAME=" $PROC "
30
+ fi
27
31
for i in $( seq 1 100) ; # wait max 100 * 300ms
28
32
do
29
33
PROCESS_CMDLINE=$( get_process_cmdline " $PID " )
30
- [[ " ${PROCESS_CMDLINE} " == * ${PROC } * ]] && break
34
+ [[ " ${PROCESS_CMDLINE} " == * ${PROC_NAME } * ]] && break
31
35
sleep 0.3s
32
36
done
33
37
}
@@ -86,7 +90,7 @@ echo "stderr file: $stderr"
86
90
CMDLINE_REGEX=' /(\w+/)+bash.*stopped_process\.sh param1 param2 param3$'
87
91
88
92
# Run zombie process (without full cmdline)
89
- ( : & exec " ${PROC} " ) &
93
+ ( SHELL_PID= $BASHPID && ( kill -STOP $SHELL_PID ) ) &
90
94
ZOMBIE_PPID=$!
91
95
ZOMBIE_PID=$( get_zombie_pid_from_ppid ${ZOMBIE_PPID} )
92
96
[ -n " ${ZOMBIE_PPID} " ]
@@ -104,7 +108,7 @@ echo "stderr file: $stderr"
104
108
# ## Wait for start of all processes (all processes have done exec())
105
109
# #######################################################################
106
110
wait_for_process $PID
107
- wait_for_process ${ZOMBIE_PID}
111
+ wait_for_process ${ZOMBIE_PID} " command_line.sh "
108
112
wait_for_process ${ESCAPED_PID}
109
113
110
114
# #######################################################################
You can’t perform that action at this time.
0 commit comments