]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Automatically answer excuse prompts if stdin is not a TTY
authorepriestley <git@epriestley.com>
Mon, 26 Aug 2013 12:41:32 +0000 (05:41 -0700)
committerepriestley <git@epriestley.com>
Mon, 26 Aug 2013 12:41:32 +0000 (05:41 -0700)
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

index 479709676b746b9389f613cf0e561ed96aa982f6..7129a49b34f87f4034111b835d20af34d1a4f045 100644 (file)
@@ -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'));