Skip to content

Commit df76a5f

Browse files
committed
Add MutexRuntimeException
1 parent 1f94f93 commit df76a5f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/MutexRuntimeException.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Illuminated\Console;
4+
5+
use RuntimeException;
6+
7+
class MutexRuntimeException extends RuntimeException
8+
{
9+
}

src/WithoutOverlapping.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Illuminated\Console;
44

5-
use RuntimeException;
65
use Symfony\Component\Console\Input\InputInterface;
76
use Symfony\Component\Console\Output\OutputInterface;
87

@@ -19,7 +18,7 @@ protected function initializeMutex()
1918
{
2019
$mutex = new Mutex($this);
2120
if (!$mutex->acquireLock($this->getMutexTimeout())) {
22-
throw new RuntimeException('Command is running now!');
21+
throw new MutexRuntimeException('Command is running now!');
2322
}
2423

2524
register_shutdown_function([$this, 'releaseMutexLock'], $mutex);

tests/WithoutOverlappingTraitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Illuminated\Console\Tests;
44

5-
use RuntimeException;
5+
use Illuminated\Console\MutexRuntimeException;
66
use Illuminated\Console\Tests\App\Console\Commands\GenericCommand;
77
use Illuminated\Console\Tests\App\Console\Commands\TimeoutCommand;
88
use Illuminated\Console\Tests\App\Console\Commands\NullTimeoutCommand;
@@ -102,7 +102,7 @@ public function it_blocks_if_trying_to_run_another_instance_of_the_command()
102102
$mutex = mock('overload:Illuminated\Console\Mutex');
103103
$mutex->expects()->acquireLock(0)->andReturn(false);
104104

105-
$this->willSeeException(RuntimeException::class, 'Command is running now!');
105+
$this->willSeeException(MutexRuntimeException::class, 'Command is running now!');
106106

107107
$this->artisan('icm:generic');
108108
}

0 commit comments

Comments
 (0)