Skip to content

Commit

Permalink
Merge pull request #1 from mybuilder/update-program-name
Browse files Browse the repository at this point in the history
Replace : with _ in command names
  • Loading branch information
gavinlove authored Oct 28, 2016
2 parents cb0787d + e8c7542 commit ec28124
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions Exporter/AnnotationSupervisorExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ private function toSupervisorAnnotations(Command $command, $server)

private function buildProgramName($commandName, $instance)
{
$pos = strrpos($commandName, ':');

$name = (false === $pos) ? $commandName : substr($commandName, $pos + 1);
$name = str_replace(':', '_', $commandName);

return (1 === $instance) ? $name : "{$name}_{$instance}";
}
Expand Down
12 changes: 6 additions & 6 deletions Tests/Command/DumpCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ public function test_dump_export()
]);

$expected = <<<OUTPUT
[program:test-command]
[program:supervisor_test-command]
autostart=true
user=mybuilder
name=test-command
name=supervisor_test-command
command=php app/console supervisor:test-command --env=test
numprocs=1
[program:test-command_2]
[program:supervisor_test-command_2]
process_name=%(program_name)s_%(process_num)02d
autostart=true
user=mybuilder
name=test-command_2
name=supervisor_test-command_2
command=php app/console supervisor:test-command --env=test
numprocs=2
[program:test-command_3]
[program:supervisor_test-command_3]
autostart=true
user=mybuilder
name=test-command_3
name=supervisor_test-command_3
command=php -d mbstring.func_overload=0 app/console supervisor:test-command --foo --env=test
numprocs=1
OUTPUT;
Expand Down

0 comments on commit ec28124

Please sign in to comment.