]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't try to run didAbortWorkflow() if the user never provided a command
authorepriestley <git@epriestley.com>
Tue, 30 Oct 2012 17:44:49 +0000 (10:44 -0700)
committerepriestley <git@epriestley.com>
Tue, 30 Oct 2012 17:44:49 +0000 (10:44 -0700)
Summary:
If you type `arc`, you currently get a fatal since $config isn't defined. Don't try to run the hook if we never built a config.

(We could build the config earlier and then run the hook anyway, but $workflow and $command would not be defined. It seems unlikely that executing the hook here is useful, since it affects only the case that the user types `arc` on its own.)

Test Plan: Typed `arc`. Typed `arc diff`, etc.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D3841

scripts/arcanist.php

index 64938edee5db61c9104b314ee758943f1df144d0..d51baaacf0e52338c2b84d8fce0c30188ff7bcfd 100755 (executable)
@@ -63,6 +63,7 @@ $args = array_values($argv);
 
 $working_directory = getcwd();
 $console = PhutilConsole::getConsole();
+$config = null;
 
 try {
 
@@ -125,9 +126,9 @@ try {
 
   $user_config = ArcanistBaseWorkflow::readUserConfigurationFile();
 
-  $config = $working_copy->getConfig('arcanist_configuration');
-  if ($config) {
-    $config = new $config();
+  $config_class = $working_copy->getConfig('arcanist_configuration');
+  if ($config_class) {
+    $config = new $config_class();
   } else {
     $config = new ArcanistConfiguration();
   }
@@ -327,7 +328,9 @@ try {
       $ex->getMessage());
   }
 
-  $config->didAbortWorkflow($command, $workflow, $ex);
+  if ($config) {
+    $config->didAbortWorkflow($command, $workflow, $ex);
+  }
 
   if ($config_trace_mode) {
     echo "\n";