Command Service throws console warn and doesn't run when base path has a space in it #25

Open
opened 2025-06-17 16:01:22 +00:00 by arvanitakis · 0 comments
Collaborator

private function runCommand(string $signature): int
{
$phpBinaryFinder = new PhpExecutableFinder();
$phpBinaryPath = $phpBinaryFinder->find();
$pid = (int)shell_exec("cd " . base_path() . " && $phpBinaryPath artisan {$signature} > /dev/null 2>&1 & echo $!");
return $pid;
}

If the base path contains a space, the command will not run and throw a warn bash : cd : too many arguments

https://code.radical-elements.com/lucent/lucent-laravel/src/commit/dfe4576725a8792327935e2064e7da6c8aa19a84/src/Command/CommandService.php#L48-L54 If the base path contains a space, the command will not run and throw a warn `bash : cd : too many arguments`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lucent/lucent-laravel#25