File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -218,10 +218,10 @@ test_force_confirmation_controls_shutdown() {
218218 run_interactive_uninstaller y " $install_dir "
219219 assert_success
220220 [ ! -e " $relay_binary " ] || fail ' accepted confirmation did not remove the Relay binary'
221+ wait " $session_pid " 2> /dev/null || true
221222 if kill -0 " $session_pid " 2> /dev/null; then
222223 fail ' accepted confirmation did not terminate the Relay process'
223224 fi
224- wait " $session_pid " 2> /dev/null || true
225225 active_session_pid=" "
226226 return 0
227227}
@@ -274,11 +274,11 @@ EOF
274274 run_interactive_uninstaller y " $install_dir "
275275 assert_success
276276 [ ! -e " $relay_binary " ] || fail ' accepted coding-agent confirmation did not remove the Relay binary'
277+ wait " $agent_pid " 2> /dev/null || true
277278 kill -0 " $agent_pid " 2> /dev/null && fail ' accepted confirmation did not terminate the coding agent owner'
278279 for child_pid in $active_child_pids ; do
279280 kill -0 " $child_pid " 2> /dev/null && fail " accepted confirmation did not terminate MCP child ${child_pid} "
280281 done
281- wait " $agent_pid " 2> /dev/null || true
282282 active_session_pid=" "
283283 active_child_pids=" "
284284 return 0
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ terminate_process_tree() {
205205wait_for_process_exit () {
206206 wait_pid=$1
207207 wait_attempt=0
208- while kill -0 " $wait_pid " 2> /dev/null ; do
208+ while process_is_running " $wait_pid " ; do
209209 if [ " $wait_attempt " -ge 5 ]; then
210210 error " process ${wait_pid} did not stop after termination was confirmed"
211211 fi
@@ -214,6 +214,14 @@ wait_for_process_exit() {
214214 done
215215}
216216
217+ process_is_running () {
218+ process_state=$( ps -p " $1 " -o stat= 2> /dev/null | sed -n ' 1p' | awk ' {$1 = $1; print}' )
219+ case " $process_state " in
220+ " " |Z* ) return 1 ;;
221+ esac
222+ kill -0 " $1 " 2> /dev/null
223+ }
224+
217225stop_active_relay_processes () {
218226 active_targets=$( active_shutdown_target_pids)
219227 [ -n " $active_targets " ] || return 0
You can’t perform that action at this time.
0 commit comments