]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Unuse $argv in `arc diff --background`
authorvrana <jakubv@fb.com>
Mon, 24 Sep 2012 18:32:38 +0000 (11:32 -0700)
committervrana <jakubv@fb.com>
Mon, 24 Sep 2012 19:02:54 +0000 (12:02 -0700)
Test Plan: This diff.

Reviewers: epriestley

Reviewed By: epriestley

CC: zeeg, aran, Korvin
Differential Revision: https://secure.phabricator.com/D3550

src/workflow/ArcanistBaseWorkflow.php
src/workflow/ArcanistDiffWorkflow.php

index e9fcf83dfd48091289ab7327d37e8f8826abfb5f..15031923cc5e5c7d15ade818f46b6ea94a4ec808 100644 (file)
@@ -64,6 +64,7 @@ abstract class ArcanistBaseWorkflow {
   private $repositoryAPI;
   private $workingCopy;
   private $arguments;
+  private $passedArguments;
   private $command;
 
   private $repositoryEncoding;
@@ -550,6 +551,10 @@ abstract class ArcanistBaseWorkflow {
     return idx($this->arguments, $key, $default);
   }
 
+  public function getPassedArguments() {
+    return $this->passedArguments;
+  }
+
   final public function getCompleteArgumentSpecification() {
     $spec = $this->getArguments();
     $arc_config = $this->getArcanistConfiguration();
@@ -559,6 +564,7 @@ abstract class ArcanistBaseWorkflow {
   }
 
   public function parseArguments(array $args) {
+    $this->passedArguments = $args;
 
     $spec = $this->getCompleteArgumentSpecification();
 
index 5bccc159500f95e59a4ada0dbebe753576814038..9bbe7e7fa5f54ad215ebcbe633f528ce53d92846 100644 (file)
@@ -380,14 +380,14 @@ EOTEXT
     $background = $this->getArgument('background', !phutil_is_windows());
 
     if ($background) {
-      $argv = $_SERVER['argv'];
-      // Insert after `arc diff`.
-      array_splice($argv, 2, 0, array('--recon', '--no-diff'));
+      $argv = $this->getPassedArguments();
       if (!PhutilConsoleFormatter::getDisableANSI()) {
-        // Insert after `arc`.
-        array_splice($argv, 1, 0, array('--ansi'));
+        array_unshift($argv, '--ansi');
       }
-      $lint_unit = new ExecFuture('php %Ls', $argv);
+      $lint_unit = new ExecFuture(
+        'php %s --recon diff --no-diff %Ls',
+        phutil_get_library_root('arcanist').'/../scripts/arcanist.php',
+        $argv);
       $lint_unit->write('', true);
       $lint_unit->start();
     }