execute_fileevent: polling for processes that do close stdout

This commit is contained in:
stefan schippers 2023-11-07 18:10:33 +01:00
parent f04477d236
commit acbe76329c
1 changed files with 6 additions and 0 deletions

View File

@ -242,6 +242,12 @@ proc execute_fileevent {id} {
set lastproc [lindex [pid $execute(pipe,$id)] end]
set ps_status [exec ps -o state= -p $lastproc]
set finished [regexp Z $ps_status] ;# if zombie consider process to be finished.
if { $eof && !$finished} {
after 2000 "execute_fileevent $id"
fileevent $execute(pipe,$id) readable ""
# puts "rescheduling $id"
return
}
} else {
set eof [eof $execute(pipe,$id)]
set finished 1