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

Provide a hook for aborted workflow

Summary:
We start Sandcastle push when `arc diff` starts.
If `arc diff` throws then HHVM waits for finishing the futures.
We need to kill them sooner.

Test Plan: Will implement the hook.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3713
This commit is contained in:
vrana 2012-10-16 10:21:56 -07:00
parent 47a036a535
commit 1b51b74135
2 changed files with 24 additions and 14 deletions

View file

@ -319,26 +319,28 @@ try {
$config->didRunWorkflow($command, $workflow, $err);
exit((int)$err);
} catch (ArcanistUsageException $ex) {
echo phutil_console_format(
"**Usage Exception:** %s\n",
$ex->getMessage());
} catch (Exception $ex) {
$is_usage = ($ex instanceof ArcanistUsageException);
if ($is_usage) {
echo phutil_console_format(
"**Usage Exception:** %s\n",
$ex->getMessage());
}
$config->didAbortWorkflow($command, $workflow, $ex);
if ($config_trace_mode) {
echo "\n";
throw $ex;
}
exit(1);
} catch (Exception $ex) {
if ($config_trace_mode) {
throw $ex;
if (!$is_usage) {
echo phutil_console_format(
"**Exception**\n%s\n%s\n",
$ex->getMessage(),
"(Run with --trace for a full exception trace.)");
}
echo phutil_console_format(
"**Exception**\n%s\n%s\n",
$ex->getMessage(),
"(Run with --trace for a full exception trace.)");
exit(1);
}

View file

@ -29,7 +29,7 @@
* - create, replace, or disable workflows by overriding buildWorkflow()
* and buildAllWorkflows();
* - add additional steps before or after workflows run by overriding
* willRunWorkflow() or didRunWorkflow(); and
* willRunWorkflow() or didRunWorkflow() or didAbortWorkflow(); and
* - add new flags to existing workflows by overriding
* getCustomArgumentsForCommand().
*
@ -93,6 +93,14 @@ class ArcanistConfiguration {
// This is a hook.
}
public function didAbortWorkflow(
$command,
ArcanistBaseWorkflow $workflow,
Exception $ex) {
// This is a hook.
}
public function getCustomArgumentsForCommand($command) {
return array();
}