| 913 | |
| 914 | |
| 915 | static int32_t try_kill_one() |
| 916 | { |
| 917 | /* Only need to check if a timeout was specified with the -l option. */ |
| 918 | if ( globs.timeout > 0 ) |
| 919 | { |
| 920 | int32_t i; |
| 921 | for ( i = 0; i < globs.jobs; ++i ) |
| 922 | if ( cmdtab[ i ].pi.hProcess ) |
| 923 | { |
| 924 | double const t = running_time( cmdtab[ i ].pi.hProcess ); |
| 925 | if ( t > (double)globs.timeout ) |
| 926 | { |
| 927 | /* The job may have left an alert dialog around, try and get |
| 928 | * rid of it before killing the job itself. |
| 929 | */ |
| 930 | close_alert( &cmdtab[ i ].pi ); |
| 931 | /* We have a "runaway" job, kill it. */ |
| 932 | kill_process_tree( cmdtab[ i ].pi.dwProcessId, |
| 933 | cmdtab[ i ].pi.hProcess ); |
| 934 | /* And return its running commands table slot. */ |
| 935 | return i; |
| 936 | } |
| 937 | } |
| 938 | } |
| 939 | return -1; |
| 940 | } |
| 941 | |
| 942 | |
| 943 | static void close_alerts() |
no test coverage detected