Skip to content

Commit

Permalink
fix: open url by browser error on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jan 24, 2021
1 parent 93f35f8 commit 91c4c14
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/Helper/AppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ public static function getLangFromENV(string $default = ''): string
public static function openBrowser(string $pageUrl): void
{
if (Sys::isMac()) {
$cmd = 'open';
$cmd = "open \"{$pageUrl}\"";
} elseif (Sys::isWin()) {
$cmd = 'cmd /c start';
// $cmd = 'cmd /c start';
$cmd = "start {$pageUrl}";
} else {
$cmd = 'x-www-browser';
$cmd = "x-www-browser \"{$pageUrl}\"";
}

Show::info("Will open the page on browser:\n $pageUrl");
Sys::execute($cmd . " \"{$pageUrl}\"");

Show::writeln("> $cmd");
Sys::execute($cmd);
}

/**
Expand Down

0 comments on commit 91c4c14

Please sign in to comment.