add timeout to some process-spawning related functions