Skip to content

Commit

Permalink
Throw a new UserAbortException instead of exit()
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Dec 3, 2023
1 parent 85ce805 commit 106dbd3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Exceptions/UserAbortException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Laravel\Prompts\Exceptions;

use RuntimeException;

class UserAbortException extends RuntimeException
{
//
}
3 changes: 2 additions & 1 deletion src/Terminal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laravel\Prompts;

use Laravel\Prompts\Exceptions\UserAbortException;
use RuntimeException;
use Symfony\Component\Console\Terminal as SymfonyTerminal;

Expand Down Expand Up @@ -75,7 +76,7 @@ public function lines(): int
*/
public function exit(): void
{
exit(1);
throw new UserAbortException();
}

/**
Expand Down

0 comments on commit 106dbd3

Please sign in to comment.