'Kill process.
"exitCode" this sets what the process return value will be.
"gracePeriod" [deprecated, not supported]
"sig" (Unix only) is the signal to use to kill the process. Defaults
to signal.SIGKILL. See os.kill() for more information.'

def kill(self, exitCode=(-1), gracePeriod=None, sig=None):

    if (gracePeriod is not None):
        import warnings
        warnings.warn('process.kill()    gracePeriod    is    no    longer    used', DeprecationWarning)
    if (self.stdin is not None):
        self.stdin.close()
    if sys.platform.startswith('win'):
        Popen.kill(self)
    else:
        if (sig is None):
            sig = signal.SIGKILL
        try:
            if self.__use_killpg:
                os.killpg(self.pid, sig)
            else:
                os.kill(self.pid, sig)
        except OSError as ex:
            if (ex.errno != 3):
                raise
        self.returncode = exitCode
