#!/bin/bash
if [ "$#" -lt 2 ]; then
	. usage "secs command [args...]"
fi
timeout="$1" ; shift
if [ -n "$needstty" ]; then
	"$@" </dev/tty &
else
	"$@" &
fi
exec 2>/dev/null
pid=$!
sleep $timeout && kill $pid && sleep 1 && kill -9 $pid && sleep 1 &
sleeppid=$!
wait $pid
status=$?
kill $sleeppid `ccpid $sleeppid`
exit $status
