From d6b1531b94b2be58d9e074e0bf2ab6c126cc4e65 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 10 Feb 2016 06:23:01 -0800 Subject: [PATCH] Use passthru to run `git fetch` in `arc land` so password prompts work Summary: Fixes T10314. In `arc land`, we currently run `git fetch` as a subprocess. However, this can prevent password prompts (when fetching over HTTP with basic authentication) from working properly. Instead, use passthru to redirect stdin/stdout to the subprocess so the user can type their password. This adds a little extra clutter to the `arc land` output but I think that's OK. Test Plan: See T10314, @maxie confirmed this fixes the issue. Reviewers: chad Reviewed By: chad Subscribers: maxie Maniphest Tasks: T10314 Differential Revision: https://secure.phabricator.com/D15233 --- src/land/ArcanistGitLandEngine.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/land/ArcanistGitLandEngine.php b/src/land/ArcanistGitLandEngine.php index 068124d0..0fe154d1 100644 --- a/src/land/ArcanistGitLandEngine.php +++ b/src/land/ArcanistGitLandEngine.php @@ -128,10 +128,22 @@ final class ArcanistGitLandEngine pht('FETCH'), pht('Fetching %s...', $ref)); - $api->execxLocal( + // NOTE: Although this output isn't hugely useful, we need to passthru + // instead of using a subprocess here because `git fetch` may prompt the + // user to enter a password if they're fetching over HTTP with basic + // authentication. See T10314. + + $err = $api->execPassthru( 'fetch -- %s %s', $this->getTargetRemote(), $this->getTargetOnto()); + + if ($err) { + throw new ArcanistUsageException( + pht( + 'Fetch failed! Fix the error and run "%s" again.', + 'arc land')); + } } private function updateWorkingCopy() {