

def fetch_gerrit_hook_ssh(path, username, server, port=None):
    ' Fetch the ``commit-msg`` hook from gerrit\n\n    '
    if (port is None):
        port = 22
    git_hooks_dir = os.path.join(path, '.git', 'hooks')
    if (not os.path.isdir(git_hooks_dir)):
        qisys.sh.mkdir(git_hooks_dir)
    if sys.platform.startswith('win'):
        git_hooks_dir = qisys.sh.to_posix_path(git_hooks_dir, fix_drive=True)
    scp = qisys.command.find_program('scp', raises=False)
    if (not scp):
        return (False, 'Could not find scp executable')
    cmd = [scp, '-P', str(port), ('%s@%s:hooks/commit-msg' % (username, server)), git_hooks_dir]
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    (out, _) = process.communicate()
    if (cmd.returncode == 0):
        return (True, '')
    else:
        return (False, out)

dataset/ETHPy150Open aldebaran/qibuild/python/qisrc/review.py fetch_gerrit_hook_ssh/VarMisuse@193/299 `process`->`cmd`