Kill by process group and set select timeout

Killing process only will leave children process residues like editor
processes, now kill process group instead to clean up all processes.

Using a timeout when calling select to avoid hang when selecting stdout
when calling commands like qemu-monitor-event.

Signed-off-by: Hao Liu <hliu@redhat.com>