From 65c19ff0c072c9c7abd4580ecdf2e781da3ebe20 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 26 Aug 2013 05:41:32 -0700 Subject: [PATCH] Automatically answer excuse prompts if stdin is not a TTY Summary: Fixes T3696. Currently, we abort. If stdin is not a TTY, we should just continue. A script which cares could conceivably run `arc lint` and `arc unit` separately, but it seems unlikely that any script would ever want to fail here. Test Plan: Ran `echo -n '' | arc diff --create --verbatim` with a lint error and got a revision (D6720). Reviewers: Firehed, btrahan, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T3696 Differential Revision: https://secure.phabricator.com/D6721 --- src/workflow/ArcanistDiffWorkflow.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index 47970967..7129a49b 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -1397,6 +1397,16 @@ EOTEXT public function handleServerMessage(PhutilConsoleMessage $message) { $data = $message->getData(); + + if ($this->getArgument('excuse')) { + try { + phutil_console_require_tty(); + } catch (PhutilConsoleStdinNotInteractiveException $ex) { + $this->excuses[$data['type']] = $this->getArgument('excuse'); + return null; + } + } + $response = ''; if (isset($data['prompt'])) { $response = phutil_console_prompt($data['prompt'], idx($data, 'history')); -- 2.43.0