From ecdaaa568cca1c4083783a5a9d89d2f35dd373e9 Mon Sep 17 00:00:00 2001 From: Evan Barter Date: Tue, 8 Sep 2020 11:12:26 -0700 Subject: [PATCH] Fix for directories with spaces --- src/NewCommand.php | 8 ++++---- tests/NewCommandTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NewCommand.php b/src/NewCommand.php index 969f6e83..d0d1e969 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -84,15 +84,15 @@ protected function execute(InputInterface $input, OutputInterface $output) if (PHP_OS_FAMILY == 'Windows') { array_unshift($commands, "rd /s /q \"$directory\""); } else { - array_unshift($commands, "rm -rf $directory"); + array_unshift($commands, "rm -rf \"$directory\""); } } if (PHP_OS_FAMILY != 'Windows') { - $commands[] = "chmod 644 $directory/artisan"; + $commands[] = "chmod 644 \"$directory/artisan\""; } - if ($this->runCommands($commands, $input, $output)->isSuccessful()) { + if (($process = $this->runCommands($commands, $input, $output))->isSuccessful()) { if ($name && $name !== '.') { $this->replaceInFile( 'APP_URL=http://localhost', @@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(PHP_EOL.'Application ready! Build something amazing.'); } - return 0; + return $process->getExitCode(); } /** diff --git a/tests/NewCommandTest.php b/tests/NewCommandTest.php index 5faae00d..52c5939d 100644 --- a/tests/NewCommandTest.php +++ b/tests/NewCommandTest.php @@ -18,7 +18,7 @@ public function test_it_can_scaffold_a_new_laravel_app() if (PHP_OS_FAMILY == 'Windows') { exec("rd /s /q \"$scaffoldDirectory\""); } else { - exec("rm -rf $scaffoldDirectory"); + exec("rm -rf \"$scaffoldDirectory\""); } }