From 653641f4e866222018fb0b7f460f83f1e5435113 Mon Sep 17 00:00:00 2001 From: Miguel Nogueira Date: Thu, 9 Jul 2020 05:52:41 +0100 Subject: [PATCH] Replace Symfony Process --- app/Console/Commands/Install.php | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/app/Console/Commands/Install.php b/app/Console/Commands/Install.php index 53792eb..933d9f5 100644 --- a/app/Console/Commands/Install.php +++ b/app/Console/Commands/Install.php @@ -54,34 +54,23 @@ class Install extends Command copy($basePath . '/.env.example', $basePath . '/.env'); $this->call('key:generate'); - - // Command stack - $npm = new Process(['/usr/bin/env npm install'], $basePath); - $npmBuild = new Process(['/usr/bin/env npm run dev'], $basePath); - - $this->info('>> Installing and preparing dependencies. This may take a while, depending on your computer.'); - $progress = $this->output->createProgressBar(3); - try - { - $npm->mustRun(); - $progress->advance(); + $npmOut = 0; + $npmBuildOut = 0; - $npmBuild->mustRun(); - $progress->advance(); - } - catch(ProcessFailedException $pfe) + exec('cd ' . $basePath . ' && npm install', null, $npmOut); + exec('cd ' . $basePath . '&& npm run dev', null, $npmBuildOut); + + + if($npmOut !== 0 && $npmBuildOut !== 0) { - $this->error('[!] One or more errors have ocurred whilst attempting to install dependencies. This is the error message: ' . $pfe->getMessage()); + $this->error('[!] One or more errors have ocurred whilst attempting to install dependencies.'); $this->error('[!] It is recommended to run this command again, and report a bug if it keeps happening.'); return false; } - finally - { - $progress->finish(); - } + $settings = [];