1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

Don't try to run didAbortWorkflow() if the user never provided a command

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
This commit is contained in:
epriestley 2012-10-30 10:44:49 -07:00
parent d96eaed097
commit 44842aeb25

View file

@ -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";