def kill_process(process):
    """
    Kill the provided process by sending it TERM signal using "pkill" shell
    command.

    Note: This function only works on Linux / Unix based systems.

    :param process: Process object as returned by subprocess.Popen.
    :type process: ``object``
    """
    kill_command = shlex.split('sudo pkill -TERM -s %s' % (process.pid))

    try:
        status = subprocess.call(kill_command)
    except Exception:
        LOG.exception('Unable to pkill process.')

    return status
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/util/shell.py/kill_process/original