set usage_version "\\s*-V, --version\\s+output version information and exit\\s+"
set usage_man "\\s*For more details see \\S+\\."
+proc kill_process pid {
+ set cmdline "kill $pid"
+ if { [catch { exec /bin/sh -c $cmdline } msg]} {
+ warning "Could not kill process: $msg\n"
+ }
+}
+
proc procps_v_version { tool } {
global topdir
set toolpath ${topdir}${tool}
set testproc1_pid [ exec $testproc_path $sleep_time & ]
set testproc2_pid [ exec $testproc_path $sleep_time & ]
}
+
+proc kill_testproc { } {
+ global testproc_path testproc1_pid testproc2_pid
+
+ kill_process $testproc1_pid
+ kill_process $testproc2_pid
+ file delete $testproc_path
+}
spawn $pgrep
expect_pass "$test" "^\(lt-\)\?pgrep: no matching criteria specified\\s*"
-# Tests that don't need the test process go above here
-if { [ catch { exec sh -c "command -v kill" } kill_path] } {
- untested { kill path not found }
- return
-}
-
make_testproc
set testproc_len [ string length $testproc_comm ]
# Cleanup
-eval exec "$kill_path $testproc1_pid"
-eval exec "$kill_path $testproc2_pid"
-file delete $testproc_path
+kill_testproc
spawn $pkill
expect_pass "$test" "^\(lt-\)\?pkill: no matching criteria specified\\s*"
-# Tests that don't need the test process go above here
-if { [ catch { exec sh -c "command -v kill" } kill_path] } {
- untested { kill path not found }
- return
-}
-
make_testproc
set testproc_len [ string length $testproc_comm ]
set testproc_trim [ string range $testproc_comm 0 [ expr { $testproc_len - 2 } ] ]
# Cleanup
-eval exec "$kill_path $testproc1_pid"
-eval exec "$kill_path $testproc2_pid"
-exec rm $testproc_path
+kill_testproc