From d5efddf430ea1f76944c91e373dd7a7358a045aa Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Tue, 21 Sep 2021 15:09:55 +0100 Subject: [PATCH] feat: allow opening URLs on multiple OSs --- src/Commands/OpenCommand.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Commands/OpenCommand.php b/src/Commands/OpenCommand.php index 2f7cb295..31fc075f 100644 --- a/src/Commands/OpenCommand.php +++ b/src/Commands/OpenCommand.php @@ -53,6 +53,14 @@ public function handle() )); } - passthru(sprintf('open https://%s', $domain)); + $openerCommand = 'open'; + + if (PHP_OS_FAMILY === 'Windows') { + $openerCommand = 'start'; + } elseif (PHP_OS_FAMILY === 'Linux') { + $openerCommand = 'xdg-open'; + } + + passthru(sprintf('%s https://%s', $openerCommand, $domain)); } }