| 944 | |
| 945 | |
| 946 | static int try_kill_one() |
| 947 | { |
| 948 | /* Only need to check if a timeout was specified with the -l option. */ |
| 949 | if ( globs.timeout > 0 ) |
| 950 | { |
| 951 | int i; |
| 952 | for ( i = 0; i < globs.jobs; ++i ) |
| 953 | if ( cmdtab[ i ].pi.hProcess ) |
| 954 | { |
| 955 | double const t = running_time( cmdtab[ i ].pi.hProcess ); |
| 956 | if ( t > (double)globs.timeout ) |
| 957 | { |
| 958 | /* The job may have left an alert dialog around, try and get |
| 959 | * rid of it before killing the job itself. |
| 960 | */ |
| 961 | close_alert( &cmdtab[ i ].pi ); |
| 962 | /* We have a "runaway" job, kill it. */ |
| 963 | kill_process_tree( cmdtab[ i ].pi.dwProcessId, |
| 964 | cmdtab[ i ].pi.hProcess ); |
| 965 | /* And return its running commands table slot. */ |
| 966 | return i; |
| 967 | } |
| 968 | } |
| 969 | } |
| 970 | return -1; |
| 971 | } |
| 972 | |
| 973 | |
| 974 | static void close_alerts() |
no test coverage detected