diff options
author | Dmitri Gopkalo <[email protected]> | 2019-08-09 01:06:07 +0300 |
---|---|---|
committer | Dmitri Gopkalo <[email protected]> | 2019-08-09 11:22:40 +0300 |
commit | 79f7983f1a8f2e0c4743cfcecd8d14c3aa0a6c4d (patch) | |
tree | 98e9995e939ea2e32583d3c24aa7aa72d32119dc /bin | |
parent | b512dd6ba4f8b809bba797ed9260b78f2ffe6822 (diff) |
- remembered about windows compatibility :) and move solution from shell awk to Perl based regex.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rr | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -198,17 +198,22 @@ class RRHelper if (is_file($finalFile)) { $version = RRHelper::getVersion(); - $previousVersion = shell_exec($finalFile . ' | awk \'/\'Version:\'/ { gsub(/[^[:digit:]\.]+/, "", $2); printf $2}\''); + $previousVersion = + preg_match('#Version:.+(\d+\.\d+\.\d+)#', (string)shell_exec($finalFile), $mathes) ? + $mathes[1] : ""; $output->writeln('<error>RoadRunner binary file already exists!</error>'); $helper = $this->getHelper('question'); if (version_compare($previousVersion, $version) === 0) { $output->writeln(sprintf('<info>Current version: %s</info>', $previousVersion)); - $question = new ConfirmationQuestion(sprintf('Skip update to the same version: %s ? [Y/n]', $version)); + $question = new ConfirmationQuestion( + sprintf('Skip update to the same version: %s ? [Y/n]', $version) + ); if ($helper->ask($input, $output, $question)) { return; } } else { - if (!$helper->ask($input, $output, new ConfirmationQuestion('Do you want overwrite it? [Y/n] '))) { + $question = new ConfirmationQuestion('Do you want overwrite it? [Y/n]'); + if (!$helper->ask($input, $output, $question)) { return; } } |