'Perform a read during which a signal will arrive.  Return True if the
read is interrupted by the signal and raises an exception.  Return False
if it returns normally.'

def readpipe_interrupted(self):

    (r, w) = os.pipe()
    self.addCleanup(os.close, r)
    ppid = os.getpid()
    pid = os.fork()
    if (pid == 0):
        try:
            time.sleep(0.2)
            os.kill(ppid, self.signum)
            time.sleep(0.2)
        finally:
            exit_subprocess()
    else:
        self.addCleanup(os.waitpid, pid, 0)
        os.close(w)
        try:
            d = os.read(r, 1)
            return False
        except OSError as err:
            if (err.errno != errno.EINTR):
                raise
            return True
