@@ -143,30 +143,18 @@ public async Task I_can_execute_a_command_and_pipe_the_stdin_from_another_comman
143
143
public async Task I_can_execute_a_command_and_pipe_the_stdin_from_another_command_with_a_transform ( )
144
144
{
145
145
// Arrange
146
- var cmdInput = Cli . Wrap ( Dummy . Program . FilePath )
147
- . WithArguments ( [ "generate binary" , "--length" , "100000" ] ) ;
148
-
149
- var cmd = Cli . Wrap ( Dummy . Program . FilePath )
150
- . WithArguments ( "length stdin" )
151
- . WithStandardInputPipe (
152
- PipeSource . FromCommand (
153
- cmdInput ,
154
- // Take only the first 5000 bytes
155
- async ( source , destination , cancellationToken ) =>
156
- {
157
- using var buffer = MemoryPool < byte > . Shared . Rent ( 5000 ) ;
158
-
159
- await source . ReadAtLeastAsync (
160
- buffer . Memory ,
161
- 5000 ,
162
- false ,
163
- cancellationToken
164
- ) ;
165
-
166
- await destination . WriteAsync ( buffer . Memory [ ..5000 ] , cancellationToken ) ;
167
- }
168
- )
169
- ) ;
146
+ var cmd =
147
+ PipeSource . FromCommand (
148
+ Cli . Wrap ( Dummy . Program . FilePath )
149
+ . WithArguments ( [ "generate binary" , "--length" , "100000" ] ) ,
150
+ // Transform: take the first 5000 bytes and discard the rest
151
+ async ( source , destination , cancellationToken ) =>
152
+ {
153
+ using var buffer = MemoryPool < byte > . Shared . Rent ( 5000 ) ;
154
+ await source . ReadAtLeastAsync ( buffer . Memory , 5000 , false , cancellationToken ) ;
155
+ await destination . WriteAsync ( buffer . Memory [ ..5000 ] , cancellationToken ) ;
156
+ }
157
+ ) | Cli . Wrap ( Dummy . Program . FilePath ) . WithArguments ( "length stdin" ) ;
170
158
171
159
// Act
172
160
var result = await cmd . ExecuteBufferedAsync ( ) ;
0 commit comments