run: close connection to spawned processes on kill

From the man page of expect:

> Both expect and interact will detect when the current process exits
> and implicitly do a close.  But if you kill the process by, say, "exec
> kill  $pid",  you  will need to explicitly call close.

Fixes #3569
This commit is contained in:
Roman Iten 2019-09-26 14:51:39 +02:00 committed by Christian Helmuth
parent b57a4c98cf
commit 6145cdcf37
2 changed files with 15 additions and 6 deletions

View File

@ -112,8 +112,7 @@ proc autopilot_run_genode_until {{wait_for_re forever} {timeout_value 0} {runnin
# kill the spawned load process if there is one
if {[load_spawn_id] != -1} {
set pid [exp_pid -i [load_spawn_id]]
exec kill -9 $pid
kill_spawned [load_spawn_id]
}
incr retry -1;
@ -830,7 +829,7 @@ while {1} {
if {$run_genode_failed} {
# shut-down running system
exec kill -9 [exp_pid -i $serial_id]
kill_spawned $serial_id
run_power_off
# remember result of last test
@ -902,7 +901,7 @@ while {1} {
{
# shut-down running system
puts "Re-booting to meet maximum number of tests per boot for this platform"
exec kill -9 [exp_pid -i $serial_id]
kill_spawned $serial_id
run_power_off
# prepare system re-boot

View File

@ -307,8 +307,7 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id
# kill the spawned load process if there is one
if {[load_spawn_id] != -1} {
set pid [exp_pid -i [load_spawn_id]]
exec kill -9 $pid
kill_spawned [load_spawn_id]
}
incr retry -1;
@ -329,6 +328,17 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id
}
##
# "Safely" kill spawned process
#
proc kill_spawned {spawn_id} {
set pid [exp_pid -i $spawn_id]
close -i $spawn_id
exec kill -9 $pid
wait -i $spawn_id
}
##
# Remove color information from output
#