{"thread":{"id":"35890","subject":"[PATCH] web--browse: Use powershell on Windows","startedAt":"2014-02-16T07:22:27Z","lastAt":"2014-02-16T16:07:30Z","messageCount":2,"participants":["Steven Penny","Eric Sunshine"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"234881","messageId":"1392535347-3008-1-git-send-email-svnpenn@gmail.com","threadId":"35890","inReplyTo":null,"subject":"[PATCH] web--browse: Use powershell on Windows","fromName":"Steven Penny","fromEmail":"svnpenn@gmail.com","sentAt":"2014-02-16T07:22:27Z","receivedAt":"2014-02-16T07:22:27Z","isPatch":true,"sender":{"key":"svnpenn@gmail.com","avatar":"https://avatars.githubusercontent.com/u/60531334?v=4"},"body":"On Windows you can have either MinGW or Cygwin. As has been shown in this script\nMinGW uses \"start\" while Cygwin uses \"cygstart\". The \"cygstart\" command is\nrobust but the \"start\" command breaks on certain URLs\n\n    $ git web--browse 'http://wikipedia.org/wiki/Key_&_Peele'\n    '_Peele' is not recognized as an internal or external command,\n    operable program or batch file.\n\nAn alternative is to use PowerShell. PowerShell is a component of Windows and\nwill work with both MinGW and Cygwin.\n\nSigned-off-by: Steven Penny <svnpenn@gmail.com>\n---\n Documentation/git-web--browse.txt |  3 +--\n git-web--browse.sh                | 19 ++++++++-----------\n 2 files changed, 9 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/git-web--browse.txt b/Documentation/git-web--browse.txt\nindex 2de575f..02cccf9 100644\n--- a/Documentation/git-web--browse.txt\n+++ b/Documentation/git-web--browse.txt\n@@ -33,8 +33,7 @@ The following browsers (or commands) are currently supported:\n * lynx\n * dillo\n * open (this is the default under Mac OS X GUI)\n-* start (this is the default under MinGW)\n-* cygstart (this is the default under Cygwin)\n+* powershell (this is the default under Windows)\n * xdg-open\n \n Custom commands may also be specified.\ndiff --git a/git-web--browse.sh b/git-web--browse.sh\nindex ebdfba6..72fbe32 100755\n--- a/git-web--browse.sh\n+++ b/git-web--browse.sh\n@@ -34,7 +34,7 @@ valid_tool() {\n \tfirefox | iceweasel | seamonkey | iceape | \\\n \tchrome | google-chrome | chromium | chromium-browser | \\\n \tkonqueror | opera | w3m | elinks | links | lynx | dillo | open | \\\n-\tstart | cygstart | xdg-open)\n+\tpowershell | xdg-open)\n \t\t;; # happy\n \t*)\n \t\tvalid_custom_tool \"$1\" || return 1\n@@ -124,13 +124,10 @@ if test -z \"$browser\" ; then\n \tthen\n \t\tbrowser_candidates=\"open $browser_candidates\"\n \tfi\n-\t# /bin/start indicates MinGW\n-\tif test -x /bin/start; then\n-\t\tbrowser_candidates=\"start $browser_candidates\"\n-\tfi\n-\t# /usr/bin/cygstart indicates Cygwin\n-\tif test -x /usr/bin/cygstart; then\n-\t\tbrowser_candidates=\"cygstart $browser_candidates\"\n+\t# OS indicates Windows\n+\tif test -n \"$OS\"\n+\tthen\n+\t\tbrowser_candidates=\"powershell $browser_candidates\"\n \tfi\n \n \tfor i in $browser_candidates; do\n@@ -179,11 +176,11 @@ konqueror)\n \t\t;;\n \tesac\n \t;;\n-w3m|elinks|links|lynx|open|cygstart|xdg-open)\n+w3m|elinks|links|lynx|open|xdg-open)\n \t\"$browser_path\" \"$@\"\n \t;;\n-start)\n-\texec \"$browser_path\" '\"web-browse\"' \"$@\"\n+powershell)\n+\t\"$browser_path\" saps \"'$@'\"\n \t;;\n opera|dillo)\n \t\"$browser_path\" \"$@\" &\n-- \n1.8.5.3\n"},{"id":"234897","messageId":"CAPig+cSJZE9dedQY2YToJ62kFBtjZhpU9b8qjtMDJqGcZvkBSQ@mail.gmail.com","threadId":"35890","inReplyTo":"1392535347-3008-1-git-send-email-svnpenn@gmail.com","subject":"Re: [PATCH] web--browse: Use powershell on Windows","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-02-16T16:07:30Z","receivedAt":"2014-02-16T16:07:30Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Feb 16, 2014 at 2:22 AM, Steven Penny <svnpenn@gmail.com> wrote:\n> On Windows you can have either MinGW or Cygwin. As has been shown in this script\n> MinGW uses \"start\" while Cygwin uses \"cygstart\". The \"cygstart\" command is\n> robust but the \"start\" command breaks on certain URLs\n>\n>     $ git web--browse 'http://wikipedia.org/wiki/Key_&_Peele'\n>     '_Peele' is not recognized as an internal or external command,\n>     operable program or batch file.\n>\n> An alternative is to use PowerShell. PowerShell is a component of Windows and\n> will work with both MinGW and Cygwin.\n>\n> Signed-off-by: Steven Penny <svnpenn@gmail.com>\n> ---\n> diff --git a/Documentation/git-web--browse.txt b/Documentation/git-web--browse.txt\n> index 2de575f..02cccf9 100644\n> --- a/Documentation/git-web--browse.txt\n> +++ b/Documentation/git-web--browse.txt\n> @@ -33,8 +33,7 @@ The following browsers (or commands) are currently supported:\n>  * lynx\n>  * dillo\n>  * open (this is the default under Mac OS X GUI)\n> -* start (this is the default under MinGW)\n> -* cygstart (this is the default under Cygwin)\n> +* powershell (this is the default under Windows)\n>  * xdg-open\n>\n>  Custom commands may also be specified.\n> diff --git a/git-web--browse.sh b/git-web--browse.sh\n> index ebdfba6..72fbe32 100755\n> --- a/git-web--browse.sh\n> +++ b/git-web--browse.sh\n> @@ -34,7 +34,7 @@ valid_tool() {\n>         firefox | iceweasel | seamonkey | iceape | \\\n>         chrome | google-chrome | chromium | chromium-browser | \\\n>         konqueror | opera | w3m | elinks | links | lynx | dillo | open | \\\n> -       start | cygstart | xdg-open)\n> +       powershell | xdg-open)\n>                 ;; # happy\n>         *)\n>                 valid_custom_tool \"$1\" || return 1\n> @@ -124,13 +124,10 @@ if test -z \"$browser\" ; then\n>         then\n>                 browser_candidates=\"open $browser_candidates\"\n>         fi\n> -       # /bin/start indicates MinGW\n> -       if test -x /bin/start; then\n> -               browser_candidates=\"start $browser_candidates\"\n> -       fi\n> -       # /usr/bin/cygstart indicates Cygwin\n> -       if test -x /usr/bin/cygstart; then\n> -               browser_candidates=\"cygstart $browser_candidates\"\n> +       # OS indicates Windows\n> +       if test -n \"$OS\"\n> +       then\n> +               browser_candidates=\"powershell $browser_candidates\"\n>         fi\n\nDoesn't this penalize users who don't have powershell installed?\n\n>         for i in $browser_candidates; do\n> @@ -179,11 +176,11 @@ konqueror)\n>                 ;;\n>         esac\n>         ;;\n> -w3m|elinks|links|lynx|open|cygstart|xdg-open)\n> +w3m|elinks|links|lynx|open|xdg-open)\n>         \"$browser_path\" \"$@\"\n>         ;;\n> -start)\n> -       exec \"$browser_path\" '\"web-browse\"' \"$@\"\n> +powershell)\n> +       \"$browser_path\" saps \"'$@'\"\n>         ;;\n>  opera|dillo)\n>         \"$browser_path\" \"$@\" &\n> --\n> 1.8.5.3\n"}]}