Skip to content

Commit 232ca72

Browse files
committed
chore: create terminate method to allow for mocking of exit method
1 parent 28eb125 commit 232ca72

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/Runtime.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function processNextEvent(): void
182182

183183
if ($this->invocations >= $this->maxInvocations) {
184184
$this->logger->info(sprintf('Killing Lambda container. Container has processed %s invocation events. (%s)', $this->maxInvocations, $event->getId()));
185-
exit(0);
185+
$this->terminate(0);
186186
}
187187
}
188188

@@ -197,7 +197,15 @@ public function start(): void
197197
$this->logger->exception($exception);
198198
$this->client->sendInitializationError($exception);
199199

200-
exit(1);
200+
$this->terminate(1);
201201
}
202202
}
203+
204+
/**
205+
* Terminate the runtime.
206+
*/
207+
protected function terminate(int $code): void
208+
{
209+
exit($code);
210+
}
203211
}

0 commit comments

Comments
 (0)