Mercurial > hg > Members > anatofuz > anatofuz-tools
changeset 8:38241ae31798
linux
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 04 Jan 2021 10:52:36 +0900 |
parents | 6c212f9834b6 |
children | 2711ab9baa52 |
files | hg-browse |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hg-browse Mon Nov 23 14:07:02 2020 +0900 +++ b/hg-browse Mon Jan 04 10:52:36 2021 +0900 @@ -14,6 +14,8 @@ exit 1; } +my $open_cmd = $^O eq 'darwin' ? "open" : "xdg-open"; #linux open cmd is xdg-open + # 無かったら特に何もしない exit 1 unless ($stdout); @@ -26,7 +28,7 @@ if ( $stdout =~ m[(https?|ssh)://(\w+@)?(.*)]){ my $url = "http://$3"; - @cmd = ('open',$url); + @cmd = ($open_cmd,$url); eval { run3 \@cmd,undef,\$stdout,\$stderr;}; if ($@){ print "error! >> $stderr"; @@ -43,7 +45,7 @@ if ($input =~ m[.*//home/hg/y(\d+)(.+)]){ $url = $http_domain . "y$1$2"; } - @cmd = ('open',$url); + @cmd = ($open_cmd,$url); eval { run3 \@cmd,undef,\$stdout,\$stderr;}; exit 0; } @@ -55,7 +57,7 @@ if (($input =~ m[.*?firefly.cr.ie.u-ryukyu.ac.jp/(.*)] )||($input =~ m[.*firefly/(.*)])){ $url = $http_domain.$1; } - @cmd = ('open',$url); + @cmd = ($open_cmd,$url); eval { run3 \@cmd,undef,\$stdout,\$stderr;}; exit 0; }