Skip to content

Commit 016e911

Browse files
Make sure the after hook cleanup is done properly
This fixes issue #170 were `afterHook` was not called if an action failed.
1 parent 0f937ee commit 016e911

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Runner/Hook.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,17 @@ public function run(): void
125125

126126
$this->beforeHook();
127127

128-
$actions = $this->getActionsToExecute($hookConfigs);
129-
// are any actions configured
130-
if (count($actions) === 0) {
131-
$this->io->write(' - no actions to execute', true);
132-
} else {
133-
$this->executeActions($actions);
128+
try {
129+
$actions = $this->getActionsToExecute($hookConfigs);
130+
// are any actions configured
131+
if (count($actions) === 0) {
132+
$this->io->write(' - no actions to execute', true);
133+
} else {
134+
$this->executeActions($actions);
135+
}
136+
} finally {
137+
$this->afterHook();
134138
}
135-
136-
$this->afterHook();
137139
}
138140

139141
/**

0 commit comments

Comments
 (0)