File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3+ using System . Linq ;
34using System . Diagnostics ;
5+ using System . ComponentModel ;
46using LibGit2Sharp ;
57using GitPullRequest . Services ;
68using McMaster . Extensions . CommandLineUtils ;
7- using System . Linq ;
89
910namespace GitPullRequest
1011{
@@ -84,7 +85,9 @@ void BrowsePullRequest(GitPullRequestService service, Repository repo)
8485 {
8586 foreach ( var pr in prs )
8687 {
87- Browse ( pr . Repository . GetPullRequestUrl ( pr . Number ) ) ;
88+ var url = pr . Repository . GetPullRequestUrl ( pr . Number ) ;
89+ Console . WriteLine ( url ) ;
90+ TryBrowse ( url ) ;
8891 }
8992
9093 return ;
@@ -99,7 +102,8 @@ void BrowsePullRequest(GitPullRequestService service, Repository repo)
99102 var compareUrl = service . FindCompareUrl ( gitRepositories , repo ) ;
100103 if ( compareUrl != null )
101104 {
102- Browse ( compareUrl ) ;
105+ Console . WriteLine ( compareUrl ) ;
106+ TryBrowse ( compareUrl ) ;
103107 return ;
104108 }
105109
@@ -175,13 +179,22 @@ void PruneBranches(GitPullRequestService service, Repository repo)
175179 }
176180 }
177181
178- void Browse ( string pullUrl )
182+ bool TryBrowse ( string url )
179183 {
180- Process . Start ( new ProcessStartInfo
184+ try
181185 {
182- FileName = pullUrl ,
183- UseShellExecute = true
184- } ) ;
186+ Process . Start ( new ProcessStartInfo
187+ {
188+ FileName = url ,
189+ UseShellExecute = true
190+ } ) ;
191+
192+ return false ;
193+ }
194+ catch ( Win32Exception )
195+ {
196+ return false ;
197+ }
185198 }
186199 }
187200}
You can’t perform that action at this time.
0 commit comments