Skip to content

Commit 5e51e6a

Browse files
Check conditions fixed
1 parent 5b00fff commit 5e51e6a

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/Console/Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ public function handle(): int
3636

3737
protected function execute(InputInterface $input, OutputInterface $output): int
3838
{
39-
try {
40-
if ($this->getIsolateOption() !== false && ! $this->isolationMutex()->create($this)) {
41-
$this->comment(sprintf('The [%s] command is already running.', $this->getName()));
39+
if ($this->getIsolateOption() !== false && ! $this->isolationMutex()->create($this)) {
40+
$this->comment(sprintf('The [%s] command is already running.', $this->getName()));
4241

43-
return $this->isolatedStatusCode();
44-
}
42+
return $this->isolatedStatusCode();
43+
}
4544

45+
try {
4646
return parent::execute($input, $output);
4747
}
4848
finally {

tests/Commands/MutexTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function testCanRunIsolatedCommandIfNotBlocked()
4747
->once();
4848

4949
$this->mutex->shouldReceive('forget')
50-
->never()
5150
->once();
5251

5352
$this->runCommand();
@@ -62,8 +61,7 @@ public function testCannotRunIsolatedCommandIfBlocked()
6261
->once();
6362

6463
$this->mutex->shouldReceive('forget')
65-
->never()
66-
->once();
64+
->never();
6765

6866
$this->runCommand();
6967

@@ -77,7 +75,6 @@ public function testCanRunCommandAgainAfterOtherCommandFinished()
7775
->twice();
7876

7977
$this->mutex->shouldReceive('forget')
80-
->never()
8178
->twice();
8279

8380
$this->runCommand();

0 commit comments

Comments
 (0)