Skip to content

Commit 590d70c

Browse files
committed
ICM: Simple info message instead of RuntimeException.
1 parent 4ae99e1 commit 590d70c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/WithoutOverlapping.php

Lines changed: 3 additions & 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,9 @@ protected function initializeMutex()
1918
{
2019
$mutex = new Mutex($this);
2120
if (!$mutex->acquireLock($this->getMutexTimeout())) {
22-
throw new RuntimeException('Command is running now!');
21+
$this->setCode(function () {
22+
$this->info('Command is running now!');
23+
});
2324
}
2425

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

tests/ConsoleMutex/WithoutOverlappingTraitTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Mockery;
77
use MysqlStrategyCommand;
88
use NullTimeoutCommand;
9-
use RuntimeException;
109
use TimeoutCommand;
1110

1211
class WithoutOverlappingTraitTest extends TestCase
@@ -102,11 +101,11 @@ public function it_throws_an_exception_if_trying_to_run_another_instance_of_the_
102101
{
103102
$mutex = Mockery::mock('overload:Illuminated\Console\Mutex');
104103
$mutex->shouldReceive('acquireLock')->with(0)->once()->andReturn(false);
105-
106-
$this->expectException(RuntimeException::class);
107-
$this->expectExceptionMessage('Command is running now!');
104+
$mutex->shouldReceive('releaseLock')->withNoArgs();
108105

109106
$this->artisan('icm:generic');
107+
108+
$this->seeArtisanOutput('Command is running now!');
110109
}
111110

112111
/**

0 commit comments

Comments
 (0)