Skip to content

Commit ba674c6

Browse files
committed
Match schedule command name exactly.
1 parent d10ab79 commit ba674c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Illuminate/Console/Scheduling/ScheduleTestCommand.php

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

33
namespace Illuminate\Console\Scheduling;
44

5+
use Illuminate\Console\Application;
56
use Illuminate\Console\Command;
67
use Illuminate\Support\Str;
78

@@ -51,7 +52,11 @@ public function handle(Schedule $schedule)
5152
}
5253

5354
if (! empty($name = $this->option('name'))) {
54-
$matches = array_filter($commandNames, fn ($commandName) => Str::endsWith($commandName, $name));
55+
$commandBinary = Application::phpBinary().' '.Application::artisanBinary();
56+
57+
$matches = array_filter($commandNames, function ($commandName) use ($commandBinary, $name) {
58+
return trim(Str::replace($commandBinary, '', $commandName)) === $name;
59+
});
5560

5661
if (count($matches) !== 1) {
5762
return $this->error('No matching scheduled command found.');

0 commit comments

Comments
 (0)