def get_cwd_for_pid(pid):
    """
    Return the current working directory for a given process ID.
    """
    if sys.platform in ('linux', 'linux2', 'cygwin'):
        try:
            return os.readlink('/proc/%s/cwd' % pid)
        except OSError:
            pass
dataset/ETHPy150Open jonathanslenders/pymux/pymux/process.py/get_cwd_for_pid/original