/**
* @param InputInterface $input
* @param OutputInterface $output
* @throws RuntimeException
* @return int|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$opener = '';
if (OperatingSystem::isMacOs()) {
$opener = 'open';
} elseif (OperatingSystem::isWindows()) {
$opener = 'start';
} else {
// Linux
if (exec('which xde-open')) {
$opener = 'xdg-open';
} elseif (exec('which gnome-open')) {
$opener = 'gnome-open';
} elseif (exec('which kde-open')) {
$opener = 'kde-open';
}
}
if (empty($opener)) {
throw new RuntimeException('No opener command like xde-open, gnome-open, kde-open was found.');
}
$this->detectMagento($output);
if ($this->initMagento($output)) {
$store = $this->getHelperSet()->get('parameter')->askStore($input, $output, 'store', true);
if ($store->getId() == Store::DEFAULT_STORE_ID) {
$url = $this->getBackendStoreUrl($store);
} else {
$url = $this->getFrontendStoreUrl($store);
}
$output->writeln('Opening URL <comment>' . $url . '</comment> in browser');
Exec::run(escapeshellcmd($opener . ' ' . $url));
}
}