Make setpgid() interruptible.

#699