#!/usr/bin/expect -f
# run a program for a given amount of time
# i.e. timeout 20 long_running_program args

set timeout [lindex $argv 0]
set sid [eval spawn -noecho [lrange $argv 1 end]]
expect {
    timeout {
        exec kill -9 $sid
        exit 99
    }
    eof {
        exit 0
    }
}
