File tree Expand file tree Collapse file tree 3 files changed +30
-5
lines changed
Expand file tree Collapse file tree 3 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 88using Zx ;
99using static Zx . Env ;
1010
11-
11+ var version = await "dotnet --version" ;
1212
1313
1414// `await string` execute process like shell
Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ public async Task<string> FirstAsync(CancellationToken cancellationToken = defau
4141 string ? data = null ;
4242 await foreach ( var item in this . WithCancellation ( cancellationToken ) . ConfigureAwait ( false ) )
4343 {
44- data = ( item ?? "" ) ;
44+ if ( data == null )
45+ {
46+ data = ( item ?? "" ) ;
47+ }
4548 }
4649
4750 if ( data == null )
@@ -62,7 +65,10 @@ public async Task<string> FirstAsync(CancellationToken cancellationToken = defau
6265 string ? data = null ;
6366 await foreach ( var item in this . WithCancellation ( cancellationToken ) . ConfigureAwait ( false ) )
6467 {
65- data = ( item ?? "" ) ;
68+ if ( data == null )
69+ {
70+ data = ( item ?? "" ) ;
71+ }
6672 }
6773 return data ;
6874 }
Original file line number Diff line number Diff line change @@ -198,9 +198,19 @@ public static IDisposable color(ConsoleColor color)
198198
199199 var runStdout = Task . Run ( async ( ) =>
200200 {
201+ var isFirst = true ;
201202 await foreach ( var item in stdout . WithCancellation ( cancellationToken ) . ConfigureAwait ( false ) )
202203 {
203- sbOut . AppendLine ( item ) ;
204+ if ( ! isFirst )
205+ {
206+ sbOut . AppendLine ( ) ;
207+ }
208+ else
209+ {
210+ isFirst = false ;
211+ }
212+
213+ sbOut . Append ( item ) ;
204214
205215 if ( verbose && ! forceSilcent )
206216 {
@@ -211,9 +221,18 @@ public static IDisposable color(ConsoleColor color)
211221
212222 var runStdError = Task . Run ( async ( ) =>
213223 {
224+ var isFirst = true ;
214225 await foreach ( var item in stderror . WithCancellation ( cancellationToken ) . ConfigureAwait ( false ) )
215226 {
216- sbError . AppendLine ( item ) ;
227+ if ( ! isFirst )
228+ {
229+ sbOut . AppendLine ( ) ;
230+ }
231+ else
232+ {
233+ isFirst = false ;
234+ }
235+ sbError . Append ( item ) ;
217236
218237 if ( verbose && ! forceSilcent )
219238 {
You can’t perform that action at this time.
0 commit comments