@@ -31,26 +31,14 @@ public List<Version> RuntimeVersions
3131 {
3232 get
3333 {
34- ProcessStartInfo startInfo = new ProcessStartInfo ( )
35- {
36- FileName = DotnetFileName ,
37- RedirectStandardOutput = true ,
38- RedirectStandardError = true ,
39- Arguments = "--list-runtimes" ,
40- } ;
41- using ( Process p = Process . Start ( startInfo ) )
42- {
43- p . WaitForExit ( ) ;
44- string output = p . StandardOutput . ReadToEnd ( ) ;
45- var list = output
46- . Split ( "\n " , StringSplitOptions . RemoveEmptyEntries )
47- . Where ( line => line . StartsWith ( "Microsoft.NETCore.App" , StringComparison . Ordinal ) )
48- . Select ( line => line . Split ( " " ) [ 1 ] )
49- . Select ( versionString => Version . Parse ( versionString ) )
50- . OrderBy ( x => x )
51- . ToList ( ) ;
52- return list ;
53- }
34+ string output = ProcessRunner . Run ( DotnetFileName , "--list-runtimes" ) ;
35+ return output
36+ . Split ( "\n " , StringSplitOptions . RemoveEmptyEntries )
37+ . Where ( line => line . StartsWith ( "Microsoft.NETCore.App" , StringComparison . Ordinal ) )
38+ . Select ( line => line . Split ( " " ) [ 1 ] )
39+ . Select ( versionString => Version . Parse ( versionString ) )
40+ . OrderBy ( x => x )
41+ . ToList ( ) ;
5442 }
5543 }
5644
@@ -72,25 +60,14 @@ public List<Version> SdkVersions
7260 {
7361 get
7462 {
75- ProcessStartInfo startInfo = new ProcessStartInfo ( )
76- {
77- FileName = DotnetFileName ,
78- RedirectStandardOutput = true ,
79- RedirectStandardError = true ,
80- Arguments = "--list-sdks" ,
81- } ;
82- using ( Process p = Process . Start ( startInfo ) )
83- {
84- p . WaitForExit ( ) ;
85- string output = p . StandardOutput . ReadToEnd ( ) ;
86- var list = output
63+
64+ string output = ProcessRunner . Run ( DotnetFileName , "--list-sdks" ) ;
65+ return output
8766 . Split ( "\n " , StringSplitOptions . RemoveEmptyEntries )
8867 . Select ( line => line . Split ( " " ) [ 0 ] )
8968 . Select ( versionString => Version . Parse ( versionString ) )
9069 . OrderBy ( x => x )
9170 . ToList ( ) ;
92- return list ;
93- }
9471 }
9572 }
9673
0 commit comments