Skip to content

Commit 196382a

Browse files
committed
Properly escape executable
Only escaping spaces it not sufficient in cases where the plugin is used from a path containing an ampersand, for example. Using escapeshellarg() on the path to the executable should be enough to handle special characters.
1 parent 835cb66 commit 196382a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ComposerPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private function runCaptainCommand(string $command): void
210210
$configuration = ' -c ' . escapeshellarg($this->configuration);
211211
$repository = $command === self::COMMAND_INSTALL ? ' -g ' . escapeshellarg($this->gitDirectory) : '';
212212
$skip = $command === self::COMMAND_INSTALL ? ' -s' : '';
213-
$executable = str_replace(' ', '\\ ', $this->executable);
213+
$executable = escapeshellarg($this->executable);
214214

215215
// sub process settings
216216
$cmd = $executable . ' ' . $command . $ansi . $interaction . $skip . $configuration . $repository;

0 commit comments

Comments
 (0)